How to Know When Previous Lines Have Been Processed in Form_Load?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nicebasic
    New Member
    • Aug 2010
    • 91

    How to Know When Previous Lines Have Been Processed in Form_Load?

    I'm writing a program in VB. When the program loads, I have to put some code in Form_Load to be processed. After that, an audio file should be played to show that the program is ready to work.

    My problem is that I can't know when the previous lines in the Form_Load have finished processing to be able to start playing an audio file.

    Imagine that you have to do large arithmetic calculations in Form_Load to allow the program be ready. Many programs put a Splash screen to let the user know that the program has been started and make him/her wait for some time.

    If I hide my form when it starts and show it in the last line of Form_Load, that doesn't solve the problem either.

    My problem is this:

    1. How to show a form named "frmSplash" immediately when my application starts and let the main form of the application "frmMain" be processed in the background?

    2. When "frmMain" finishes processing, how can I know that it's finished processing to hide or Unload "frmSplash" and turn "frmMain" to visible?

    I don't know how to use DoEvents. Can anyone help me solve this problem?

    Thank you in advance.
  • Guido Geurs
    Recognized Expert Contributor
    • Oct 2009
    • 767

    #2
    Attached is an example.
    The program starts with the FormSplash witch starts FormMain but isn't visible.
    Formmain fills the textboxes.
    When finished, FormSplash is invisible and FormMain becomes visible.
    Attached Files

    Comment

    • Guido Geurs
      Recognized Expert Contributor
      • Oct 2009
      • 767

      #3
      Maybe this is even better:
      Start formmain but invisible and show the form with the loading info.
      When loading is done, unload the form with info and make formmain visible. (see attachment)
      Attached Files

      Comment

      • nicebasic
        New Member
        • Aug 2010
        • 91

        #4
        Thank you, Mr. Guido Geurs,

        You're really innovative. You have used a Frame to simulate a Progress Bar.

        Thank you for your help and attention.

        This version is much better.

        Good luck.

        Comment

        Working...