Results 1 to 3 of 3

Thread: Loop but update form without "hanging"

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    The Netherlands
    Posts
    94

    Loop but update form without "hanging"

    I'm doing a big loop in my program and throughout the loop I'm updating the textbox in the form.

    However the form "hangs" untill the loop is done. How can I keep the form visible and be able to read the updated textbox while the loop is still running?
    I tried Me.Update() but it didn't work. I'm sure there was something like processdata or something like that but I can't find it anymore...

    Example

    Code:
    For x = 1 To 10000
    
        form1.textbox.text=x
        Me.Update()
    
    Next
    "Against All Odds"

  2. #2
    PowerPoster cicatrix's Avatar
    Join Date
    Dec 2009
    Location
    Moscow, Russia
    Posts
    3,654

    Re: Loop but update form without "hanging"

    Add Application.Doevents into the cycle body.

    Code:
    For x = 1 To 10000
    
        form1.textbox.text=x
        Application.DoEvents()
    
    Next

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2001
    Location
    The Netherlands
    Posts
    94

    Re: Loop but update form without "hanging"

    yes that was it!!! application.doevents().

    thanks!
    "Against All Odds"

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