Protected Overrides Sub OnClick() Dim myForm As frmWindowsForm If myForm Is Nothing Then myForm = New frmWindowsForm End If If myForm.Visible Then myForm.Hide() Else myForm.Show() End If myForm = Nothing End Sub
Dim myForm As frmWindowsForm [in class constructor, set this] myForm = Nothing Protected Overrides Sub OnClick() If myForm Is Nothing Then myForm = New frmWindowsForm End If If myForm.Visible Then myForm.Hide() Else myForm.Show() End If End Sub