
Chris has submitted a code example useful when you need to center an MDI child form within the parent window. In order to accomplish this, create a SUB as shown below. The SUB (CenterChild) requires two arguments. The first of these two arguments is the name of the MDI (parent) form. The second argument is the name of the MDI Child form.
Sub CenterChild (Parent As Form, Child As Form)
Dim iTop As Integer
Dim iLeft As Integer
If Parent.WindowState <> 0 Then Exit Sub
iTop = ((Parent.Height - Child.Height) \ 2)
iLeft = ((Parent.Width - Child.Width) \ 2)
Child.Move iLeft, iTop ' (This is more efficient than setting Top and Left properties)
End Sub
Sub Form_Click ()
CenterChild MDIForm1, Form1
End Sub