Results 1 to 3 of 3

Thread: [02/03] strange Thread Issue

  1. #1

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

    [02/03] strange Thread Issue

    I have an application in VB.NET 2003 whose flow is something like this. As the application starts, a Timer runs after 5 seconds, which first of all disables itself, then calls a function FillGrid. This function in turn calls a Thread. The function in this Thread does the work and in the end re enables the timer to go through the whole cycle again.
    Everything seems to be OK but the problem is that the timer does not get re enabled which means that the application goes only one cycle where as it is meant to run inifinitely. here is the code.
    VB Code:
    1. Private Sub timerUCI_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timerUCI.Tick
    2.             'Disable this Timer
    3.             timerUCI.Enabled = False
    4.             'Fill Grid
    5.             FillGrid()
    6.     End Sub
    7.  
    8. Private Sub FillGrid()
    9.                     'Some Code
    10.  
    11.                     'Initialize Thread
    12.                     thrConverter = New Threading.Thread(AddressOf StartConversion)
    13.  
    14.  
    15.                     'Start Thread for Conversion
    16.                     thrConverter.Start()
    17.  
    18.     End Sub
    19.  
    20. Private Sub StartConversion()
    21.         'Conversion Process
    22.  
    23.         'Re Enable Timer
    24.         timerUCI.Enabled = True
    25.     End Sub
    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
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [02/03] strange Thread Issue

    Have you tried putting the timerUCI.Enabled = True line inside a Try-Catch statement?
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  3. #3

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

    Re: [02/03] strange Thread Issue

    I dint earlier, but did it after your reply, but to no avail as i knew there were no exceptions, the application is running fine.
    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]

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