This is another attempt at solving an issue with respect to multiple instances of a form.
Here is what I want to do:
Button_1: When clicked it will check to see if an instance of the form exists. If it does it will get rid of it and open a new blank one.
Button_2: When clicked it will check to see if an instance of the form exists. If it does it will revert to it. If it does not it will open a new one. The following code was offered previously but there is a problem:
If (Not IsNothing(Form2)) AndAlso (Not Form2.IsDisposed) Then
Form2 = New Form2
The problem is that 'IsDisposed' is not a member of the Form. Show how do I implement Button_1 and how do I fix Button_2.
I am using VB.Net is VS 2003.
NOTE: The IsDisposed part of the code was an attempt to prevent 'System.ObjectDisposedException' error. This error occurs when the user cliicks Button_2 once, causing Form 2 to appear. If the user closes Form2 then clicks Button_2 again the error appears.