Need help with multithreading this application.

hacktheplanet

Newbie
Joined
Aug 30, 2013
Messages
1
Reaction score
0
How do I multi thread this code? I will give a image because websites don't always format text the best.


Problem: I get this error whenever I try to run it. 'AddressOf' operand must be the name of a method (without parentheses). (BC30577)

Note: This isn't the real code, for privacy reasons, but this is the base.
Capture.PNG
 
You are doing it wrong.

as you know threading means running multiple tasks simultanuously =>

whenever you use a timer, you already are multithreading because a timer tick happens next to the main thread.

if you want to do it properly, remove your timers (this is old-school and will give you limited control over your threads)

here is a simple but usefull example on starting to multithread: howtostartprogramming.com/vb-net/vb-net-tutorial-53-multithreading/

whenever someone presses button1... it will run through button1_click => thread.start() will initiate countup()...... in normal circumstances (single threaded), the entire application would wait untill countup is finished before button1_click finishes, => but now it runs asynchronously and button1_click will finish before count_up .... the effect of this is that your User interface will accept user input while countup() is still running.

hope this helps.
 
Back
Top