StartUpPosition property

I want to center the login form. While I'm trying to set the StartUpPosition property to 2-CenterScreen, i'm coming up with the error: 'Invalid property Value'.
Also I've tried the following code:

Private Sub Form_Load()
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
End Sub

And also this code:

Private Sub Form_Load()
Me.Left = (Screen.Width - Me.Width) / 2
Me.Top = (Screen.Height - Me.Height) / 2
End Sub

But I don't think the form is exactly at the center of the screen.

I want to know why am I unable to set the StartUpPosition property. If that's not possible, is the code I've used the only alternative?
[744 byte] By [sireeshapulipati] at [2007-11-20 8:26:00]
# 1 Re: StartUpPosition property
Hello,

May you explain ?
1) the StartUpPostion property of a Form can be set only at design time
2) at design time you cant set it to 2 (no error !)
3) your first code will do exactly the same, but can be executed at runtime
4) you say
"But I don't think the form is exactly at the center of the screen."

could you say why you think so, exactly ?
Could you too precise what, then, you call "the screen" ? (the full screen ?something else (and what ?) ?
moa at 2007-11-9 19:38:14 >
# 2 Re: StartUpPosition property
In my case, during design time the StartupPosition property is not taking any value except the 0-Manual. I donno why.

Regarding the code, yeah it works well. By changing height/2 to height/3 i could get what I want. I wasn't clear myself what I wanted. This will do for now.

Thanks.
sireeshapulipati at 2007-11-9 19:39:14 >