Z
Zack Sessions
I am using VB.NET 2003.
I have read the threads concerning the problem where the
FormStartPosition of CenterParent is ignored if the form is displayed
with the Show method as opposed to the ShowDialog method. I am having
a similar problem and I found a thread that had the following code in
the child form's Load event:
Me.Location = New Point(( _
Me.MdiParent.ClientSize.Width - Me.Width) * 0.5,
_(Me.MdiParent.ClientSize.Height - Me.Height) * 0.5)
My code stream is a little convoluted. In the app's main form, I call
a function that is in a Module from a command button OnClick event. In
that function I open the child form that I would like to center over
the app's main form. The problem is, that in the context of the called
function (apparently since it is located in a module and not a
function in the main form's class) the MdiParent is undefined and the
centering code returns an error.
I know moving the called function from the module to the main form's
class would probably fix this problem, but I am reluctant to resort to
that.
Any suggestions?
I have read the threads concerning the problem where the
FormStartPosition of CenterParent is ignored if the form is displayed
with the Show method as opposed to the ShowDialog method. I am having
a similar problem and I found a thread that had the following code in
the child form's Load event:
Me.Location = New Point(( _
Me.MdiParent.ClientSize.Width - Me.Width) * 0.5,
_(Me.MdiParent.ClientSize.Height - Me.Height) * 0.5)
My code stream is a little convoluted. In the app's main form, I call
a function that is in a Module from a command button OnClick event. In
that function I open the child form that I would like to center over
the app's main form. The problem is, that in the context of the called
function (apparently since it is located in a module and not a
function in the main form's class) the MdiParent is undefined and the
centering code returns an error.
I know moving the called function from the module to the main form's
class would probably fix this problem, but I am reluctant to resort to
that.
Any suggestions?