how to stop reopen form which already opened

  • Thread starter Thread starter endran
  • Start date Start date
E

endran

Hi Friends

how to stop reopen form which already opened.

for example my form code is like this
every time when i click opening the form i want to stop
that please help

M.A.Endran
Private Sub mnuRefSalesEXE_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
mnuRefSalesEXE.Click, mnuMainRefSalesExe.Click

Dim objfrmSalesExe As New frmSalesExe
objfrmSalesExe.Show()

End Sub
 
Try this:

Private objfrmSalesExe As New frmSalesExe

Private Sub mnuRefSalesEXE_Click(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
mnuRefSalesEXE.Click, mnuMainRefSalesExe.Click

objfrmSalesExe.Show()
objfrmSales.Focus()

End Sub

Raul Ropero
www.all-done-com
 
Here's the code I use when I click on a particular tabpage (I'm embedding
forms in my tab pages):

Private Sub TabPage1_Enter(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TabPage1.Click
Dim oControl As Control = findControl(sender, GetType(SubForm))
If oControl Is Nothing Then
Dim oSubForm As New SubForm
oSubForm.TopLevel = False
oSubForm.FormBorderStyle = FormBorderStyle.None
oSubForm.Parent = sender
oSubForm.Dock = DockStyle.Fill
oSubForm.Show()
oControl = oSubForm
End If
oControl.Focus()
End Sub

Public Function findControl(ByVal oParent As Control, ByVal oType As
Type) As Control
For Each myControl As Control In oParent.Controls
If myControl.GetType Is oType Then
Return myControl
End If
Next
End Function
 
Back
Top