Results 1 to 4 of 4

Thread: form loading difficulties..

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    Hi,

    I have a form which has code in it's load event to do some processing.. The problem is, the form does not become visible until the code has completed.. Is there a way of loading a form and allowing it to be visible first before the code executes?

    The reason is that this particular code takes awhile. I have a label on the form which says "Please wait...", but like I said earlier, it's not becoming visible until after the code has executed so it serves not purpose..

    any help would be appreciated..

    Dan

  2. #2
    Guest
    Put the load code in teh Form_Activate event instead of the load, or put the code in a sub called "DoStuff", then call the form like this:

    Code:
    Load Form1
    Form1.Show
    DoEvents
    Form1.DoStuff
    - gaffa

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2000
    Posts
    1,091
    Thanks for the help but it did not fix my problem..

    I tried both of your suggestions. I tried putting the code in the Activate event and also the code the you supplied. Both result in a problem.

    The Activate event still seems to fire off the code before the form as time to show on the screen. The code you supplied shows the form but never executes the code and stays in an infinite loop, probably because of the DoEvents..

    There has got to be a way to allow a form to show completely on the screen before executing the code..

    Any other ideas?


  4. #4
    Guest
    Move your stuff into the Activate Event:


    Code:
    Option Explicit
    Dim bFormLoaded As Boolean
    
    
    Private Sub Form_Load()
    
       bFormLoaded = True
    
    End Sub
    
    Private Sub Form_Activate()
       If Not bFormLoaded Then Exit Sub
       
       'this will show the form
       Me.Refresh
       
       'do your stuff here
    
    End Sub

    larryn

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