midi form can open 1

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear all
i have a parent form and have some menuitem to load midi form. how can i only allow use can only load ONE midi form of the same item
 
Hello

Hum.. for your problem, i think you could disable the menuitem when the MDI form is loaded (so when user have clicked on the menuitem). Like this, user won't be able to click on the menuitem and so, won't be able to open more than 1 MDI form.
 
If users click on the menutem, it opens the MDI form ?

So, in the click event of your menuitem, put the code for dsisbale this menuitem (or all the menuitem, as you want )

Bye.
 
I use the following function. You call the function with the name of the
form. If the form is open then show the form if the form is not open create
a new form.


private void menuDataQuery_Click(object sender, System.EventArgs e)
{
if(!this.CheckFormOpen("frmDataQuery"))
{
frmDataQuery frm = new frmDataQuery();
frm.MdiParent = this;
frm.Show();
}
}



private bool CheckFormOpen(string name)
{
foreach(System.Windows.Forms.Form frm in this.MdiChildren)
{
if(frm.Name == name)
{
frm.BringToFront();
return true;
}
}
return false;
}

Regards,
John
 
coding by car

Private Sub mnuFrmHandling(ByVal frmName As String)
For Each frm As Form In Me.MdiChildren
If frm.Name = frmName Then
frm.BringToFront()
Exit Sub
End If
Next
Dim frmNew As Form
Select Case frmName
Case "Persons"
frmNew = New frmPersons
Case "Actions"
frmNew = New frmActions
Case Else
frmNew = New frmTabellen(frmName)
End Select
frmNew.MdiParent = Me
frmNew.Show()
frmNew.WindowState = FormWindowState.Maximized
frmNew.Name = frmName
frmNew.BringToFront()
End Sub

regards
 
Back
Top