Only way I have seen to do this as of yet is to pass the form that you will use to center on. As in pass the parent form to the child. The best way to do this is overload the MyBase.New
This is what you want.
In your child add this.
Private ParentForm as "frmParentName"
Inside the windows forms designer code overload the Sub New like this.
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
Public Sub New(ByRef tmpForm As "frmParentForm"
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
ParentForm = tmpForm
End Sub
This will overload the Sub New command so when you goto call the form in your parent form you will now call it like this.
ChildForm = New frmChildForm(Me)
Now inside your child form on the load you can center it to the parent like this.
Public Sub CenterMe(ByRef tmpForm As Form, ByRef _ tmpParentForm As frmParentForm)
tmpForm.Left = (tmpParentForm.Left.ToString + ((tmpParentForm.Width.ToString / 2) - (tmpForm.Width / 2)))
tmpForm.Top = (tmpParentForm.Top.ToString + ((tmpParentForm.Height.ToString / 3) - (tmpForm.Height / 2)))
I know this is alot of code but if you put it in a module you can center all your forms on any parent or passed form.
Hope it helps you out.
-Matt
End Sub