Excuse me for being a bit of a newbie but I am having trouble with multiple forms. I use a code to open my form to be sure that only one instance of the form is open at a time but it is not working in the sitiuation I need it now. Basically I open a main menu form which can open a search form making a selection on the search form then opens the final form. My issue is I don't want 2 final forms open at the same time and I also want the search form closed when the final form is open and all this needs to be done while leaving the main menu form open. I understand the issue I am using a variable for the form and checking if that variable is nothing to see if the form is open or closed but when I close the form that contains the variable it becomes nothing and when it reopens it thinks the form is closed. Hope that wasn't too confusing. Any ideas are appreciated and thanks for the patience.
Basically when you make a selection on the search form (2nd form) I run the following which will open the final form (3rd Form)and close the search form leaving the original Main Menu open. I don't want the user clicking on the Main Menu opening the search form again and selecting a new search to open a second instance of the Final Form:
Dim FinalForm as frmFinalForm
me.close
If Not IsNothing(FinalForm) Then
If Not FinalForm.IsDisposed Then
FinalForm.WindowState = FormWindowState.Normal
FinalForm.BringToFront()
Else
FinalForm = New frmFinalForm
FinalForm.Show()
Else
FinalForm = New frmFinalForm
FinalForm.Show()
End If
Basically when you make a selection on the search form (2nd form) I run the following which will open the final form (3rd Form)and close the search form leaving the original Main Menu open. I don't want the user clicking on the Main Menu opening the search form again and selecting a new search to open a second instance of the Final Form:
Dim FinalForm as frmFinalForm
me.close
If Not IsNothing(FinalForm) Then
If Not FinalForm.IsDisposed Then
FinalForm.WindowState = FormWindowState.Normal
FinalForm.BringToFront()
Else
FinalForm = New frmFinalForm
FinalForm.Show()
Else
FinalForm = New frmFinalForm
FinalForm.Show()
End If
Last edited: