opening form only one time

  • Thread starter Thread starter mf_sina
  • Start date Start date
M

mf_sina

Which is the best way to prevent opening a form which is already open?
my program has an mdiparent form and when the user opens frmcustomers, can
edit records.
now if the user again opens this form a new instance will be created and the
same form opens again.
what i can do to prevent this?
I'm using VB .Net and winxp
 
mf_sina said:
Which is the best way to prevent opening a form which is already open?
my program has an mdiparent form and when the user opens frmcustomers, can
edit records.
now if the user again opens this form a new instance will be created and
the same form opens again.
what i can do to prevent this?

\\\
Private WithEvents m_TheChild As Form1

Private Sub m_TheChild_Closed( _
ByVal sender As Object, _
ByVal e As EventArgs _
) Handles m_TheChild.Closed
m_TheChild = Nothing
Me.Button1.Enabled = True
End Sub

Private Sub Button1_Click( _
ByVal sender As Object, _
ByVal e As EventArgs _
) Handles Button1.Click
Me.Button1.Enabled = False
m_TheChild = New Form1
m_TheChild.MdiParent = Me
m_TheChild.Show()
End Sub
///
 
Back
Top