Results 1 to 6 of 6

Thread: Do Events

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    313

    Do Events

    i remember in vb6 if i was in a loop like a do until or a do while i could put a do events call in there to let the cpu do it's thing and then return back to my loop. well i try that same thing in vb.net and there is no do events command, can anyone help me.

  2. #2
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    try Application.DoEvents()
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  3. #3
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Even better, you should run your loop in a seperate thread for better performance. Just make sure the method can be called with no arguments and then start the new thread.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2000
    Location
    Texas
    Posts
    313
    edneeis, I would have no clue how to do that. but thank you for the help guys.

  5. #5
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by Edneeis
    Even better, you should run your loop in a seperate thread for better performance. Just make sure the method can be called with no arguments and then start the new thread.
    I've worked with threads for only one or two times why is it better if it would accept no arguments?
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  6. #6
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    To start a new thread the method can't take arguments. THere are ways around this though.

    Here is an example of threading:
    VB Code:
    1. Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
    2.         Dim t As New Threading.Thread(AddressOf DoLongSomething)
    3.         t.Start()
    4.     End Sub
    5.  
    6.     Private Sub DoLongSomething()
    7.         Dim cnt As Integer = 0
    8.         Do Until cnt = cnt.MaxValue
    9.             cnt += 1
    10.         Loop
    11.         MsgBox("Done")
    12.     End Sub

    If you put a textbox and a button (the button links to the one in code) then press the button to start the looping code and notice you can still interact with the textbox and rest of the program no problem. You could even put something in the closing event to warn the user that a thread is still running before they shut down (if they shut down with one running that is).

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