sopheak
asked on
Proper order
I have 2 forms, frmMain and frmSplash.
I want to have the Splash screen up first while the Main form is loading in the background.
This my code below in the Splash form....
-------------------
Option Explicit
Private Sub Pause(interval)
Dim Current
Current = Timer
Do While Timer - Current < Val(interval)
DoEvents
Loop
End Sub
Private Sub Form_Load()
Load FrmMain
Call Pause(5)
FrmMain.Show
End Sub
-------------------------- ----
This code seems to work but, it seems to take a long time to load the splash screen. If I were to take the Private Sub Form_Load() out, the splash screen loads a lot quicker.
Any suggestions is appreciated
I want to have the Splash screen up first while the Main form is loading in the background.
This my code below in the Splash form....
-------------------
Option Explicit
Private Sub Pause(interval)
Dim Current
Current = Timer
Do While Timer - Current < Val(interval)
DoEvents
Loop
End Sub
Private Sub Form_Load()
Load FrmMain
Call Pause(5)
FrmMain.Show
End Sub
--------------------------
This code seems to work but, it seems to take a long time to load the splash screen. If I were to take the Private Sub Form_Load() out, the splash screen loads a lot quicker.
Any suggestions is appreciated
Move your code to the Form Activate sub and be sure to unload your splash form.
e.g.
Private Sub Form_Activate()
Load FrmMain
Call Pause(5)
FrmMain.Show
Unload FrmSplash
End Sub
e.g.
Private Sub Form_Activate()
Load FrmMain
Call Pause(5)
FrmMain.Show
Unload FrmSplash
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You could also put your code in the Activate event of the splash form. This wouldn't be a problem because the Splash form would be unloaded anyway after your main form is loaded. Therefore, the Activate event would never be called again to cause a problem.
ASKER
Thanks, AzraSound. I removed the load frmMain and it works great.
Sub Main()
frmSplash.Show
End Sub