J
jcrouse
I have an odd issue going on with the calling of my forms. I have an
application that has a wizard. The wizard consists of about eight forms that
the user makes choices on. Each form has a "Back" and "Next" button. When
the user selects the "Next" button the form's user choices are saved to
variables and then the form is disposed and the next form called. The
problem is that when debugging I put a stopwatch on a form_load event on one
of the forms but the event never fires, even though the form appears on the
screen. How can this happen? I'm confused. IF it hit the back button the
next is still does the same thing. Even though the back button should also
dispose of the form. If I close the form with the "X" in the title bar then
go back through the wizard a second time, the form_load event fires. It's
almost like the form is already there or something. I have even added a
form.dispose() to the startup form for all of the forms in the wizard just
to try and get rid of them if they somehow already exist. Here is some of my
code:
Sub Main()
Dim frmSC as new frmSaveConfig
... much more code
End Sub
Public Class myForms
Private Shared m_frmSaveConfig As frmSaveConfig
Public Shared Property frmSaveConfig() As frmSaveConfig
Get
Return m_frmSaveConfig
End Get
Set(ByVal Value As frmSaveConfig)
m_frmSaveConfig = Value
End Set
End Property
... many more forms exist here
End Class
This is the code from the btn_Next click event of the calling form:
If frmSC Is Nothing OrElse frmSC.IsDisposed Then
frmSC = New frmSaveConfig
myForms.frmSaveConfig = frmSC
End If
ico.Dispose()
bm.Dispose()
Me.Dispose()
frmSC.ShowDialog()
Thanks,
John
application that has a wizard. The wizard consists of about eight forms that
the user makes choices on. Each form has a "Back" and "Next" button. When
the user selects the "Next" button the form's user choices are saved to
variables and then the form is disposed and the next form called. The
problem is that when debugging I put a stopwatch on a form_load event on one
of the forms but the event never fires, even though the form appears on the
screen. How can this happen? I'm confused. IF it hit the back button the
next is still does the same thing. Even though the back button should also
dispose of the form. If I close the form with the "X" in the title bar then
go back through the wizard a second time, the form_load event fires. It's
almost like the form is already there or something. I have even added a
form.dispose() to the startup form for all of the forms in the wizard just
to try and get rid of them if they somehow already exist. Here is some of my
code:
Sub Main()
Dim frmSC as new frmSaveConfig
... much more code
End Sub
Public Class myForms
Private Shared m_frmSaveConfig As frmSaveConfig
Public Shared Property frmSaveConfig() As frmSaveConfig
Get
Return m_frmSaveConfig
End Get
Set(ByVal Value As frmSaveConfig)
m_frmSaveConfig = Value
End Set
End Property
... many more forms exist here
End Class
This is the code from the btn_Next click event of the calling form:
If frmSC Is Nothing OrElse frmSC.IsDisposed Then
frmSC = New frmSaveConfig
myForms.frmSaveConfig = frmSC
End If
ico.Dispose()
bm.Dispose()
Me.Dispose()
frmSC.ShowDialog()
Thanks,
John