Hi,
I'm trying to create multiple instances of a child form. This form has an event that feeds a string variable back to the parent so I'm declaring it with WithEvents which is declared outside of the Sub - meaning multiple clicks will not open multiple forms.
Any idea on another method of doing this while keeping the event?:
Dim WithEvents FRestoreDB As New FormRestoreDB()
Private Sub BtnOpenDB_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnOpenDB.Click
If Not IsNothing(FRestoreDB) Then
If Not FRestoreDB.IsDisposed Then
FRestoreDB.StartPosition = FormStartPosition.Manual
FRestoreDB.Show()
Else
FRestoreDB = New FormRestoreDB()
FRestoreDB.Show()
End If
Else
FRestoreDB = New FormRestoreDB()
FRestoreDB.Show()
End If
End Sub