I have an issue with a Child Form of a MDI Child staying contained within the
Master Form.

My first Form is called mdiMaster, which opens the mainMenu form with the
following code:
Dim MainMenu As New MainMenu
MainMenu.MdiParent = Me
MainMenu.Show()

Then a button click event of the mainMenu opens an application form with the
following code:
Dim applicantion As New applicantion
applicantion.MdiParent = Me.MdiParent
applicantion.Show()

The problem occurs when the application form tries to open another form, I
have the following code:
Dim searchForms As New SearchForms
searchForms.MdiParent = Me.MdiParent
searchForms.Show()

The problem is that searchForms does not stay contained in the mdiMaster
form. I tried the following syntax:
searchForms.MdiParent = Me.MdiParent.MdiParent

which caused a runtime error and hung the application.

Also, I have the mdiMaster IsMdiContainer form property set to true.

Any suggestions? Thanks.

RE: How to keep a Child Form of a MDI Child contained by v-jetan

v-jetan
Mon Jun 20 02:46:59 CDT 2005

Hi,

Thanks for your post.

For this issue, can you provide a little sample project(specific to this
problem) to help us reproduce out your problem? You can attach it in the
reply with Outlook Express.

Normally, I have review your sample code snippet, which should work well.
With your sample repropduce project, I think we can understand your problem
much better.

Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


RE: How to keep a Child Form of a MDI Child contained by jmh

jmh
Mon Jun 20 05:18:03 CDT 2005

Do you want me to send it to your online.microsoft.com email address?

""Jeffrey Tan[MSFT]"" wrote:

> Hi,
>
> Thanks for your post.
>
> For this issue, can you provide a little sample project(specific to this
> problem) to help us reproduce out your problem? You can attach it in the
> reply with Outlook Express.
>
> Normally, I have review your sample code snippet, which should work well.
> With your sample repropduce project, I think we can understand your problem
> much better.
>
> Thanks
>
> Best regards,
> Jeffrey Tan
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
>
>

RE: How to keep a Child Form of a MDI Child contained by v-jetan

v-jetan
Mon Jun 20 21:46:22 CDT 2005

Hi jmh,

Yes, normally, we suggest you attach your sample project as an attachment
when replying post(through Outlook Express). This will benifit the entire
community. However, if you still can not attach it, you may directly email
me at v-jetan@online.microsoft.com(remove the "online.").

Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


RE: How to keep a Child Form of a MDI Child contained by v-jetan

v-jetan
Thu Jun 23 03:23:02 CDT 2005

Hi Josh,

I have received your sample project and reproduced out your problem on my
side.

After reviewing your project, I found that it seems the problem occurs in
"applicantion" class. In the btnResults_Click event, you code like this:

Private Sub btnResults_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnResults.Click
Dim FirstNameVal As String = txtFirstName.Text
Dim MiddleNameVal As String = txtMiddleName.Text
Dim LastNameVal As String = txtLastName.Text
Dim SuffixVal As String = txtSuffix.Text
Dim SSN As String = mtxtSSN.CtlText
Me.Close()

Dim searchForms As New searchForms
searchForms.MdiParent = Me.MdiParent 'Not working....
searchForms.Show()
searchForms.txtFirstName.Text = FirstNameVal
searchForms.txtMiddleName.Text = MiddleNameVal
searchForms.txtLastName.Text = LastNameVal
searchForms.txtSuffix.Text = SuffixVal
searchForms.txtSSN.Text = SSN
End Sub

We can see that you invoked Me.Close() method before searchForms.MdiParent
= Me.MdiParent. This is where the problem occurs out: after Me.Close()
calling, Me.MdiParent property will be "nothing".

To get rid of the problem, we only need to place Me.Close method after
Me.MdiParent calling, like this:
Private Sub btnResults_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnResults.Click
Dim FirstNameVal As String = txtFirstName.Text
Dim MiddleNameVal As String = txtMiddleName.Text
Dim LastNameVal As String = txtLastName.Text
Dim SuffixVal As String = txtSuffix.Text
Dim SSN As String = mtxtSSN.CtlText

Dim searchForms As New searchForms
searchForms.MdiParent = Me.MdiParent 'Not working....
searchForms.Show()
searchForms.txtFirstName.Text = FirstNameVal
searchForms.txtMiddleName.Text = MiddleNameVal
searchForms.txtLastName.Text = LastNameVal
searchForms.txtSuffix.Text = SuffixVal
searchForms.txtSSN.Text = SSN
Me.Close()
End Sub
=========================================================
Thank you for your patience and cooperation. If you have any questions or
concerns, please feel free to post it in the group. I am standing by to be
of assistance.

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.


RE: How to keep a Child Form of a MDI Child contained by jmh

jmh
Thu Jun 23 05:19:02 CDT 2005

Thanks.

""Jeffrey Tan[MSFT]"" wrote:

> Hi Josh,
>
> I have received your sample project and reproduced out your problem on my
> side.
>
> After reviewing your project, I found that it seems the problem occurs in
> "applicantion" class. In the btnResults_Click event, you code like this:
>
> Private Sub btnResults_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles btnResults.Click
> Dim FirstNameVal As String = txtFirstName.Text
> Dim MiddleNameVal As String = txtMiddleName.Text
> Dim LastNameVal As String = txtLastName.Text
> Dim SuffixVal As String = txtSuffix.Text
> Dim SSN As String = mtxtSSN.CtlText
> Me.Close()
>
> Dim searchForms As New searchForms
> searchForms.MdiParent = Me.MdiParent 'Not working....
> searchForms.Show()
> searchForms.txtFirstName.Text = FirstNameVal
> searchForms.txtMiddleName.Text = MiddleNameVal
> searchForms.txtLastName.Text = LastNameVal
> searchForms.txtSuffix.Text = SuffixVal
> searchForms.txtSSN.Text = SSN
> End Sub
>
> We can see that you invoked Me.Close() method before searchForms.MdiParent
> = Me.MdiParent. This is where the problem occurs out: after Me.Close()
> calling, Me.MdiParent property will be "nothing".
>
> To get rid of the problem, we only need to place Me.Close method after
> Me.MdiParent calling, like this:
> Private Sub btnResults_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles btnResults.Click
> Dim FirstNameVal As String = txtFirstName.Text
> Dim MiddleNameVal As String = txtMiddleName.Text
> Dim LastNameVal As String = txtLastName.Text
> Dim SuffixVal As String = txtSuffix.Text
> Dim SSN As String = mtxtSSN.CtlText
>
> Dim searchForms As New searchForms
> searchForms.MdiParent = Me.MdiParent 'Not working....
> searchForms.Show()
> searchForms.txtFirstName.Text = FirstNameVal
> searchForms.txtMiddleName.Text = MiddleNameVal
> searchForms.txtLastName.Text = LastNameVal
> searchForms.txtSuffix.Text = SuffixVal
> searchForms.txtSSN.Text = SSN
> Me.Close()
> End Sub
> =========================================================
> Thank you for your patience and cooperation. If you have any questions or
> concerns, please feel free to post it in the group. I am standing by to be
> of assistance.
>
> Best regards,
> Jeffrey Tan
> Microsoft Online Partner Support
> Get Secure! - www.microsoft.com/security
> This posting is provided "as is" with no warranties and confers no rights.
>
>

RE: How to keep a Child Form of a MDI Child contained by v-jetan

v-jetan
Thu Jun 23 21:07:16 CDT 2005

You are welcome :-)

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.