Instead of End use a procedure
VB Code:
Public Sub Unload_AllForms() Dim udoForm As Form For Each udoForm In Forms Unload udoForm Next End Sub
Also, make your startup relative to one procedure, eg Sub Main()
VB Code:
Public Sub Main() If App.PrevInstance Then Unload_AllForms Exit Sub 'just in case End IF frmSplash.Show vbModal 'unloads after 10 secs or user click 'execution continues after frmSplash hhihdden or unloaded frmMain.Show vbModeless 'Execution continues even if frmMain not hidden unloaded cause its shown modeless 'Other startup algo if applicable End Sub
Showing frmMain modal would prevent Sub Main() from finishing.
VB Code:
Private Sub frmSplash_Load() TimerUnload.Interval = 10000 TimerUnload.Enabled = True 'Set to false in design time End Sub Private Sub frmSplash_Click() Unload Me End Sub Private Sub timerUnload_timer() Unlaod Me End Sub




Reply With Quote