MDI application

sonamk

New member
Joined
Jun 19, 2007
Messages
2
Programming Experience
Beginner
Hi…. folks/experts

I have created a mdiParent form and several form which I have set as mdiChild. I have a menu bar on the mdiParent and when I click any of the buttons, I have written the following piece of code:

VB.NET:
Dim objSearch As frmSearch
objSearch = New frmSearch
objSearch.MdiParent = Me
objSearch.Show()

this works fine and its is displayed within the bounds of the the mdiParent.

Now once I have displayed the search form I list the search results using a list viewer. On selecting the particular record I am loading the frmDetails where the entire details are displayed.

However I would like to load frmDetails as a mdiChild so that it falls within the bounds of the mdiParent but the moment I set it the program just flashes the frmDetails once on the screen and then disappears. The code is as follows:

VB.NET:
Private Sub lsvSearch_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles lsvSearch.SelectedIndexChanged

Me.close()			    ‘ to close the search form
frmDetails.mdiParent  = Me  ‘ This causes the form to disappear
frmDetails.Show()
Dim sP As New ListView.SelectedListViewItemCollection(lsvSearch)
Dim vSlNo As Integer = sP.Item(0).SubItems.Item(0).Text
frmDetails.loadDetails(vSlNo)

End Sub
Please suggest as to how I could tackle this issue.


:confused:
 
Last edited by a moderator:
frmDetails.mdiParent = Me? If you want the frmDetails to have the same mdiParent maybe you should say so: frmDetails.mdiParent = Me.mdiParent, and if you want it done you have to do while you still have a "Me", before you Close it.
 
Back
Top