Make your own free website on Tripod.com

Center Control On Form

'Add 1 CommandButton To Your Form.
'This example center CommandButton on the form. You can do the same with other controls.
'Insert the following code to your form:

Private Sub Command1_Click()
'Replace all the 'Command1' below with the name of the control you want to center.
Command1.Left = (Form1.Width - Command1.Width) / 2
Command1.Top = (Form1.Height / 2 - Command1.Height)
End Sub

Go Back