|
-
Oct 27th, 2002, 01:27 AM
#1
Thread Starter
Hyperactive Member
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.
-
Oct 27th, 2002, 02:06 AM
#2
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!!
-
Oct 27th, 2002, 02:53 AM
#3
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.
-
Oct 27th, 2002, 10:33 AM
#4
Thread Starter
Hyperactive Member
edneeis, I would have no clue how to do that. but thank you for the help guys.
-
Oct 27th, 2002, 12:45 PM
#5
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!!
-
Oct 27th, 2002, 03:39 PM
#6
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:
Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
Dim t As New Threading.Thread(AddressOf DoLongSomething)
t.Start()
End Sub
Private Sub DoLongSomething()
Dim cnt As Integer = 0
Do Until cnt = cnt.MaxValue
cnt += 1
Loop
MsgBox("Done")
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|