Dear Sir/Madam,
In a MDI application, for opening a form in the MDI, I am using the following code
As you can see, I need loopong through all the open child forms. Is this the only way? Or is there a better technique?Code:Private Sub RoleToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RoleToolStripMenuItem.Click Dim lobj_ChildForm As frmRole 'Check if form is already open lobj_ChildForm = Nothing For Each lobj_OpenForm In Me.MdiChildren() If lobj_OpenForm.Name = frmRole.Name Then lobj_ChildForm = lobj_OpenForm End If Next If Not (lobj_ChildForm Is Nothing) Then lobj_ChildForm.BringToFront() Else lobj_ChildForm = New frmRole lobj_ChildForm.MdiParent = Me lobj_ChildForm.Show() End If End Sub
Regards,
Partha




Reply With Quote