Since built in functionality for positioning forms in VB.NET are not always suitable to use I try to make my sub to do that.
But I missed something...
I know this is an old post and this doesn't directly answer the question, but for anyone else who stumbles upon this thread, centering a form can be done simply without requiring you to write your own procedure.
The System.Windows.Forms.Form.CenterToScreen()
and System.Windows.Forms.Form.CenterToParent()
allow you to center the a form in reference to the screen or in reference to the parent form depending on which one you need.
One thing to note is that these procedures MUST be called before the form is loaded. It is best to call them in the form_load event handler.
EXAMPLE CODE:
Private Sub Settings_Load(sender As Object, e As EventArgs) Handles Me.Load
Me.CenterToScreen()
'or you can use
Me.CenterToParent()
End Sub