[RESOLVED] Splash Screen / Loading Form
Using VB 6.0
OK, I'm a dork... and am having a hard time getting this to work.
Scenario:
Main Form = frmMain
Command Button = cmdOpen
Splash Screen = frmSplash
Form to Open = frmStuff
- I want Open "frmStuff" via "cmdOpen"
- While "frmStuff" is loading... I want "frmSplash" to appear
- When "frmStuff" has loaded, I want "frmSplash" to Unload... and "frmStuff" to Show
Here's how I've tried to code, but things are not working out:
frmMain
Private Sub cmdOpen_Click()
frmSplash.Show
frmStuff.Load
frmSplash
*** Here is where I don't know what to code, to recognize that "frmStuff" has finished loading... and to Close/Unload "frmSplash"... and to Show "frmStuff" ***
Any Help / Advice is GREATLY appreciated!!!
Re: Splash Screen / Loading Form
I use Sub Main() to show a splash screen while I'm doing stuff in the background:
VB Code:
Public Sub Main()
' Shows splash screen
frmSplash.Show
frmSplash.Refresh
' Does other things
Call CheckLocalSettings
Load CriteriaSelection
' Takes away splash screen and shows main form
Unload frmSplash
CriteriaSelection.Show
End Sub
Re: Splash Screen / Loading Form
This is to check if the page is complete before continuing.
visual basic code:
Private Sub WB1_DocumentComplete(ByVal pDisp As Object, URL As Variant)
If pDisp = WB1 Then
'Page Complete so go to next routine
End If
End Sub
use this code u could add show and hide what ever you want hope this helps this code was posted by lintz.
Re: Splash Screen / Loading Form
Quote:
Originally Posted by eklips
This is to check if the page is complete before continuing.
Check again...this has nothing to do at all with webbrowser. He is talking about forms loading
Re: Splash Screen / Loading Form
Re: Splash Screen / Loading Form
disruptivehair,
What is:
' Does other things
Call CheckLocalSettings
I like your code, just need to clarify what CheckLocalSettings is...
Thanks!!!
Re: Splash Screen / Loading Form
Quote:
Originally Posted by balanj
disruptivehair,
What is:
' Does other things
Call CheckLocalSettings
I like your code, just need to clarify what CheckLocalSettings is...
Thanks!!!
balanj, it's not something you have to use; I just copied my own Sub Main() code and stuck it in here. You can just take out "Call CheckLocalSettings" and replace it with whatever code you need to run while your splash screen is being displayed.
But since you're curious, CheckLocalSettings calls a function that checks the registry on the user's machine. It used to do more than just checking the registry but then we went to DSN-less connections. Here's the CheckReg() code called by CheckLocalSettings:
VB Code:
Public Function CheckReg()
Dim strDriver As String
strDriver = ReadRegistry(HKEY_LOCAL_MACHINE, "SOFTWARE\ODBC\ODBCINST.INI\SQL Server", "Driver")
If strDriver = "Not Found" Then
Call WriteRegistry(HKEY_LOCAL_MACHINE, "SOFTWARE\ODBC\ODBCINST.INI\SQL Server", "Driver", 1, "c:\windows\system32\sqlsrv32.dll")
End If
End Function
I should add that I did not actually write CheckReg(); it was written for our team by someone much more capable than I am. :bigyello: