Results 1 to 3 of 3

Thread: Very slow, howcome?

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    3

    Question

    I'm having trouble with performance in VB. I want to do a big loop with some math inside it. At the same time I want to display the result in a label.

    Why can't VB manage to show the label until the loop has ended? Help me somone!

    Down below is an example:

    Private Sub Command1_Click()

    For i = 1 To 2000000
    For x = 1 To 10
    a = a + i * x
    Next x
    Label1.Caption = a
    Next i

    End Sub

  2. #2
    Hyperactive Member
    Join Date
    Jan 1999
    Location
    Rotterdam, Netherlands
    Posts
    386
    Put DoEvents after you set the caption.
    Hope this helps

    Crazy D

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Or Refresh the label inside the loop

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