Results 1 to 9 of 9

Thread: Question on forum loading

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2005
    Posts
    181

    Question on forum loading

    hey. So in my program I have it set to download a file when the program loads. I made a method and i put that in the Form_load routine. The program is that, it starts the download before the form is even visible. So since its downloading the file, the forum doesnt end up showing up until the file is done downloading. I tried to use 'If me.visible = true', but that still had the same result. I also tried the 'Visibility Changed' Method. Any ideas?

    John

  2. #2
    Fanatic Member -TPM-'s Avatar
    Join Date
    Jul 2005
    Posts
    850

    Re: Question on forum loading

    The quick and easy method is application.doevents, or you could download it on a seperat thread
    TPM

    Add yourself to the VBForums Frappr Map!!

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2005
    Posts
    181

    Re: Question on forum loading

    how do i do it with application.doevents?

  4. #4
    Fanatic Member -TPM-'s Avatar
    Join Date
    Jul 2005
    Posts
    850

    Re: Question on forum loading

    Just put it in the form load before you start downloading.
    TPM

    Add yourself to the VBForums Frappr Map!!

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    May 2005
    Posts
    181

    Re: Question on forum loading

    hmm that didnt seem to work, can you tell me how to do the thread idea?

  6. #6
    Fanatic Member -TPM-'s Avatar
    Join Date
    Jul 2005
    Posts
    850

    Re: Question on forum loading

    Hmm that's odd, I thought you could just use application.doevents, I tried it and it'll work if you put me.show before it. Your probably better off using a thread though. Here's a link that explains how to do it:
    http://www.devx.com/getHelpOn/10MinuteSolution/20365
    TPM

    Add yourself to the VBForums Frappr Map!!

  7. #7
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: Question on forum loading

    The form does not become visible until the Load event handler completes. You should use the Activated event instead, which is raised after the form becomes visible. Unlike the Load event, the Activated event can be raised multiple times for the same form, so you would need a Static or class-level variable to indicate whether this was the first time the event had been raised.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  8. #8
    Frenzied Member Phill64's Avatar
    Join Date
    Jul 2005
    Location
    Queensland, Australia
    Posts
    1,201

    Re: Question on forum loading

    An easier way yet is to simply call "Me.Visible = True" at the beginning of the load event, and perhaps doevents will also be required after this, but testing with that and a message box, the form is visible when the message box appears.

    P.S Jm, whats with you disabling pm's and emails

  9. #9
    Frenzied Member maged's Avatar
    Join Date
    Nov 2002
    Location
    Egypt
    Posts
    1,040

    Re: Question on forum loading

    i think starting it in a new thread at form load is the right course of action.

    New thread to run the download will make the form loading and file downloading execute in parallel


    rgds

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