Hi I was working on a more elegant solution to OlderTimer's problem of showing a splash screen.
thread796-300075
I was thinking of something like this
Sub main()
Dim frmSplash As New frmSplash()
'disable the hide button until initialization complete
frmSplash.btnHide.Enabled = False
frmSplash.Show()
'now do our initialization
Dim frmMain As New frmMain()
'now just enable the hide button
frmSplash.btnHide.Enabled = True
frmMain.ShowDialog()
End Sub
and under frmSplash, then btnHide would do this
Private Sub btnHide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHide.Click
Me.Hide()
Me.Dispose()
End Sub
This kind of code works under VB6 - you don't have to use the equivalent of ShowDialog - forms initialised in Sub Main persist until the app ends.
However in .net, if you don't use ShowDialog, the GC collects the forms and ends the app, and if you do use ShowDialog, then even though frmMain can instantiate new forms, the user cannot hide frmSplash.
I also tried instanstiating frmSplash from the frmMain Load Event, but then I cannot see an easy way to set focus for frmSplash.
Any ideas?
Mark
PS This is my first .net post so be gentle!
thread796-300075
I was thinking of something like this
Sub main()
Dim frmSplash As New frmSplash()
'disable the hide button until initialization complete
frmSplash.btnHide.Enabled = False
frmSplash.Show()
'now do our initialization
Dim frmMain As New frmMain()
'now just enable the hide button
frmSplash.btnHide.Enabled = True
frmMain.ShowDialog()
End Sub
and under frmSplash, then btnHide would do this
Private Sub btnHide_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnHide.Click
Me.Hide()
Me.Dispose()
End Sub
This kind of code works under VB6 - you don't have to use the equivalent of ShowDialog - forms initialised in Sub Main persist until the app ends.
However in .net, if you don't use ShowDialog, the GC collects the forms and ends the app, and if you do use ShowDialog, then even though frmMain can instantiate new forms, the user cannot hide frmSplash.
I also tried instanstiating frmSplash from the frmMain Load Event, but then I cannot see an easy way to set focus for frmSplash.
Any ideas?
Mark
PS This is my first .net post so be gentle!