Hi guys.
I want when I click a button , it show form2 but if i click it again , it don't show form2...
Can help me ?
Printable View
Hi guys.
I want when I click a button , it show form2 but if i click it again , it don't show form2...
Can help me ?
One method is to set a private form level variable as shown below. After the form is shown the variable is set to false which prevents the form from being shown again.
Code:Private ShowForm2 As Boolean = True
Private Sub cmdShowForm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdShowForm.Click
If ShowForm2 Then
Dim f As New Form2
Try
f.ShowDialog()
Finally
f.Dispose()
End Try
ShowForm2 = False
End If
End Sub