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.