When user clicks on x and then I need to reload that form
I was needing to add .hide and .shows on the form the only time now I run into the previous error is when I close the form by clicking on the x.
1. Is there away to avoid the previous error if a user closed the form by clicking the x and then I need to reload that form again?
If anyone can help me with this issue I would greatly appreciate it.
Thanks to everyone on vbforums.
The help is outstanding.
Previous error:
An unhandled exception of type 'System.ObjectDisposedException' occurred in system.windows.forms.dll
Additional information: Cannot access a disposed object named "Form2".
Thanks again for all the help.
Dan Schuessler
Problem Solved No class or module
I'm not sure if this is the correct way to do it in vb.net but it works.
I just had to add this to each form.
#Region "Upgrade Support "
Private Shared m_vb6FormDefInstance As Form2
Private Shared m_InitializingDefInstance As Boolean
Public Shared Property DefInstance() As Form2
Get
If m_vb6FormDefInstance Is Nothing OrElse m_vb6FormDefInstance.IsDisposed Then
m_InitializingDefInstance = True
m_vb6FormDefInstance = New Form2()
m_InitializingDefInstance = False
End If
DefInstance = m_vb6FormDefInstance
End Get
Set(ByVal Value As Form2)
m_vb6FormDefInstance = Value
End Set
End Property
#End Region
Thanks
Dan Schuessler