Results 1 to 5 of 5

Thread: [RESOLVED] On form load problems

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Resolved [RESOLVED] On form load problems

    Hi all,

    I'm currently writing a program where one form loads another. The next form does stuff, but it won't display until it finishes doing the stuff, but I need it to appear before, since it tells you what it's doing.

    Example:

    "form1", onclick of button "1":

    Code:
    form1.visible = false
    load form2
    form2.visible = true
    unload form1
    "form2", Form_load event:
    Code:
    <DoSomeStuff>
    graphic1.visible = true
    <DoSomeStuff>
    graphic2.visible = true
    What should happen is that form 1 dissapears, form 2 appears, and as each "<DoSomeStuff>" happens, the user can see each graphic load.

    What actually happens is, you click the button "1", the form pauses for a sew seconds (as the actions in the Form_load of form 2 are being carried out), and then form 2 loads, with all the graphics in place.

    I thought I could solve it by putting all the code from form 2's Form_load event into a seperate function, I.e.

    "form2", Form_load event:
    Code:
    SecondBit
    "form2", Private Function SecondBit:
    Code:
    <DoSomeStuff>
    graphic1.visible = true
    <DoSomeStuff>
    graphic2.visible = true
    But it still had the same problem. I've also tried using the "sleep" thingy and a timer in form_load to give it time to load the form before executig the code, but it just adds to the loading time.

    So, how would I go about doing this?

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: On form load problems

    Rather than Form_Load events, you can use Form_Activate instead

  3. #3
    Lively Member ichix_jaxx's Avatar
    Join Date
    Nov 2005
    Location
    mindanao, philippines
    Posts
    88

    Re: On form load problems

    i really don't fully understand what your app is trying to do... but, if your using a command button to load another form, you should unload the first form... for example...

    "on click"
    unload form1
    form2.show

  4. #4
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901

    Re: On form load problems

    You don't have to, as the Load event re-initializes everything. I hide forms so that the values stay the same when it is re-shown.

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2005
    Posts
    248

    Re: On form load problems

    Works perfectly dglienna, thank you

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