Results 1 to 2 of 2

Thread: [02/03] Timer / Multithreading in VB.NET Console APP

  1. #1

    Thread Starter
    Addicted Member hyousuf2's Avatar
    Join Date
    Dec 2004
    Location
    Dublin
    Posts
    226

    [02/03] Timer / Multithreading in VB.NET Console APP

    In my VB.NET Console App, i want to use timers for multithreading functionality. this is my Sub Main

    VB Code:
    1. Sub Main()
    2.         tmrMain.Enabled = True
    3.         tmrMain.Interval = 3000
    4.     End Sub

    But the application starts and ends, which means that there should be a way to make the console applications wait and pass control to other threads ! how do i do that ?
    Women ...r like tea bags, you neva know how strong they really r untill u put them in hot water

    Huzefa Yousuf
    Software Engineer
    Verticity Inc.
    +92-345-2235303

    [email protected]

  2. #2
    Code Monkey wild_bill's Avatar
    Join Date
    Mar 2005
    Location
    Montana
    Posts
    2,993

    Re: [02/03] Timer / Multithreading in VB.NET Console APP

    Disable your timer when you want the app to end
    VB Code:
    1. tmrMain.Enabled = True
    2.         tmrMain.Interval = 3000
    3.         While tmrMain.Enabled
    4.             System.Threading.Thread.CurrentThread.Sleep(10000)
    5.         End While

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