Results 1 to 7 of 7

Thread: [RESOLVED] Splash Screen / Loading Form

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Jun 2006
    Posts
    83

    Resolved [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!!!

  2. #2
    Hyperactive Member
    Join Date
    Oct 2006
    Location
    USA
    Posts
    476

    Re: Splash Screen / Loading Form

    I use Sub Main() to show a splash screen while I'm doing stuff in the background:

    VB Code:
    1. Public Sub Main()
    2.  
    3.     ' Shows splash screen
    4.     frmSplash.Show
    5.     frmSplash.Refresh
    6.  
    7.     ' Does other things
    8.     Call CheckLocalSettings
    9.    
    10.     Load CriteriaSelection
    11.  
    12.     ' Takes away splash screen and shows main form
    13.     Unload frmSplash
    14.     CriteriaSelection.Show
    15.  
    16. End Sub

  3. #3
    Lively Member
    Join Date
    Oct 2006
    Posts
    74

    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.

  4. #4
    PowerPoster
    Join Date
    May 2006
    Location
    Location, location!
    Posts
    2,673

    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
    Well, everyone else has been doing it :-)
    Loading a file into memory QUICKLY - Using SendKeys - HyperLabel - A highly customisable label replacement - Using resource files/DLLs with VB - Adding GZip to your projects
    Expect more to come in future
    If I have helped you, RATE ME! :-)

    I love helping noobs with their VB problems (probably because, as an amateur programmer, I am only slightly better at VB than them :-)) but if you SERIOUSLY want to get help for free from a community such as VBForums, you have to first have a grounding (basic knowledge) in VB6, otherwise you're way too much work to help...You've got to give a little if you want to get help from us, in other words!

    And we DON'T do your homework. If your tutor doesn't teach you enough to help you make the project without his or her help, FIND A BETTER TUTOR or try reading books on programming! We are happy to help with minor things regarding the project, but you have to understand the rest of it if you want our help to be useful.

  5. #5
    Lively Member
    Join Date
    Oct 2006
    Posts
    74

    Re: Splash Screen / Loading Form

    opss my bad =)

  6. #6

    Thread Starter
    Lively Member
    Join Date
    Jun 2006
    Posts
    83

    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!!!

  7. #7
    Hyperactive Member
    Join Date
    Oct 2006
    Location
    USA
    Posts
    476

    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:
    1. Public Function CheckReg()
    2.  
    3. Dim strDriver As String
    4.  
    5. strDriver = ReadRegistry(HKEY_LOCAL_MACHINE, "SOFTWARE\ODBC\ODBCINST.INI\SQL Server", "Driver")
    6.  
    7. If strDriver = "Not Found" Then
    8.     Call WriteRegistry(HKEY_LOCAL_MACHINE, "SOFTWARE\ODBC\ODBCINST.INI\SQL Server", "Driver", 1, "c:\windows\system32\sqlsrv32.dll")
    9. End If
    10.  
    11. 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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width