|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Timer1_Tick is never firedEnableTimer from the main form. EnableTimer enable Timer1 in the main form. When I debug the program, it goes to EnableTimer, and although it sets Timer1.Enabled = True and call Timer1.Start(), Timer1_Tick is never fired. Why is Timer1_Tick did not get called ? No matter I set the Interval of Timer1 to 1 or 4000, Timer1_Tick is never fired. Thank you. Codes from the main form: Public Class frmQuoteServer Private Session As WorkerThread = Nothing Private WorkerThread As Threading.Thread = Nothing : Session = New WorkerThreadWorkerThread = New Threading.Thread(AddressOf Session.ThreadMain) ' Initialize the client session object with the reference to ' this form, and the socket that was created Session.ClientForm = Me ' Initialize the worker thread and start its execution WorkerThread.Name = "WorkerThread" WorkerThread.Start() : Public Sub EnableTimer()Timer1.Enabled = True Timer1.Start() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TimerGlobex.Tick Logon() Timer1.Enabled = False End Sub Codes from the thread: Public Class WorkerThread Public ClientForm As frmServer = Nothing Public Sub ThreadMain() : If bDisconnect Then ClientForm.EnableTimer()Exit Sub End Sub fniles wrote:
> I have a main form who calls a worker thread. Inside the thread, I call Your timer tick event seems to handle the tick event from a timer> EnableTimer from the main form. > EnableTimer enable Timer1 in the main form. When I debug the program, it > goes to EnableTimer, and although it sets Timer1.Enabled = True and call > Timer1.Start(), Timer1_Tick is never fired. > Why is Timer1_Tick did not get called ? No matter I set the Interval of > Timer1 to 1 or 4000, Timer1_Tick is never fired. called TimerGlobex, but you are only enabling the timer for Timer1. Do you have more than one timer? > Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As Where is the handler for Timer1?> System.EventArgs) Handles TimerGlobex.Tick > Logon() > Timer1.Enabled = False > End Sub I am sorry, a typo in this forum.
It should have been: Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Logon() Timer1.Enabled = False End Sub Show quoteHide quote "Chris Dunaway" <dunaw***@gmail.com> wrote in message news:1150492341.379966.139910@f6g2000cwb.googlegroups.com... > fniles wrote: >> I have a main form who calls a worker thread. Inside the thread, I call >> EnableTimer from the main form. >> EnableTimer enable Timer1 in the main form. When I debug the program, it >> goes to EnableTimer, and although it sets Timer1.Enabled = True and call >> Timer1.Start(), Timer1_Tick is never fired. >> Why is Timer1_Tick did not get called ? No matter I set the Interval of >> Timer1 to 1 or 4000, Timer1_Tick is never fired. > > > Your timer tick event seems to handle the tick event from a timer > called TimerGlobex, but you are only enabling the timer for Timer1. Do > you have more than one timer? > > >> Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As >> System.EventArgs) Handles TimerGlobex.Tick >> Logon() >> Timer1.Enabled = False >> End Sub > > Where is the handler for Timer1? > Fniles,
For threading is the threading.timer http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemthreadingtimerclasstopic.asp It has no tick event, which is in the form class, which can only be used on forms. Don't ask any help for the rest from me, I hate this threading timer and will forever try to come around it. Cor Show quoteHide quote "fniles" <fni***@pfmail.com> schreef in bericht news:%2324lvqYkGHA.5108@TK2MSFTNGP02.phx.gbl... >I am sorry, a typo in this forum. > > It should have been: > Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As > System.EventArgs) Handles Timer1.Tick > Logon() > Timer1.Enabled = False > End Sub > > > "Chris Dunaway" <dunaw***@gmail.com> wrote in message > news:1150492341.379966.139910@f6g2000cwb.googlegroups.com... >> fniles wrote: >>> I have a main form who calls a worker thread. Inside the thread, I call >>> EnableTimer from the main form. >>> EnableTimer enable Timer1 in the main form. When I debug the program, it >>> goes to EnableTimer, and although it sets Timer1.Enabled = True and call >>> Timer1.Start(), Timer1_Tick is never fired. >>> Why is Timer1_Tick did not get called ? No matter I set the Interval of >>> Timer1 to 1 or 4000, Timer1_Tick is never fired. >> >> >> Your timer tick event seems to handle the tick event from a timer >> called TimerGlobex, but you are only enabling the timer for Timer1. Do >> you have more than one timer? >> >> >>> Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As >>> System.EventArgs) Handles TimerGlobex.Tick >>> Logon() >>> Timer1.Enabled = False >>> End Sub >> >> Where is the handler for Timer1? >> > >
FileSystemWatcher raises Changed Twice....
Memory Leaks Overrides and mybase ?? Refer to an Instance of a form Date time format Flash SWF in VS2005 .net? Printing over network... Can we seperate the Bussiness Logic and User Interface? How to "Archive" a text file with multiple handles open vb.net form that behaves like Access? |
|||||||||||||||||||||||