-
I have been using this to center forms:
Code:
myform.left = (Screen.Width - myform.Width) / 2
myform.top = (Screen.Height - myform.Height) / 2
I have seen somewhere where they explained how to center the form with only one line of code. Anyone know how? I can't find the site anywhere.
-
This seems to work for me:
Code:
Form1.Move (Screen.Width - Form1.Width) / 2, (Screen.Height - Form1.Height) / 2
-
That was it, move.
Thanks a lot
-
Forms in VB6 have a StartupPosition Property which you can set to 2 (= CenterScreen).
Of course, as the name of the property implies, this only works when the form starts.