1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need help with multithreading this application.

Discussion in 'Visual Basic .NET' started by hacktheplanet, Oct 9, 2013.

  1. hacktheplanet

    hacktheplanet Newbie

    Aug 30, 2013
    Likes Received:
    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.
  2. neutralhatter

    neutralhatter Regular Member

    Jun 23, 2010
    Likes Received:
    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.
    • Thanks Thanks x 1