473,396 Members | 1,768 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Timer1_Tick is never fired

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.

Thank you.

Codes from the main form:
Public Class frmQuoteServer
Private Session As WorkerThread = Nothing
Private WorkerThread As Threading.Thread = Nothing
:
Session = New WorkerThread
WorkerThread = 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
Jun 16 '06 #1
3 7199
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?

Jun 16 '06 #2
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" <du******@gmail.com> wrote in message
news:11**********************@f6g2000cwb.googlegro ups.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?

Jun 16 '06 #3
Fniles,

For threading is the threading.timer

http://msdn.microsoft.com/library/de...classtopic.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
"fniles" <fn****@pfmail.com> schreef in bericht
news:%2****************@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" <du******@gmail.com> wrote in message
news:11**********************@f6g2000cwb.googlegro ups.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?


Jun 17 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mustaq | last post by:
Hi I am unable to get Timer1_Tick event in Windows Service Application inspite of setting following things Timer1.enabled = True Timer1.interval = 1000 Let me know how to resolve Thanks &
2
by: Jack Addington | last post by:
I have created an event and delegate combination for use in a user control when I place it on a form. However because I'm not actually doing anything in the event in the user object I didn't...
2
by: D. Shane Fowlkes | last post by:
I posted this on the MS IIS NG but that NG is slow to respond so I thought I'd try here to.... I'm using ASP(.NET) trickery to show the number of "current users" on one of my web sites...
12
by: D. Shane Fowlkes | last post by:
This is a repost (pasted below). Since my original post, I've double checked the system clock and set all IIS Session Timeout values to 10 minutes. Still ...the problem occurs. I've also...
5
by: Franck | last post by:
Hello, I'm trying to count the number of current user that way public class Global : System.Web.HttpApplication { public static int nbUsers; protected void Application_Start(Object sender,...
4
by: Markus Stoeger | last post by:
Hi, I have a problem with Application.Run() when Windows is shutting down. Please have a look at the copy&paste example program below. The application has no forms. It has only got a notify...
2
by: =?Utf-8?B?SmV0dCBKb25lcw==?= | last post by:
I'm working on a webdav client which makes multiple webrequests using the threadpool. The initial issue was that some requests never returned, though I could attach to the application and see...
2
by: AMDRIT | last post by:
Hello Everyone, I am having an issue where an event appears to be fired repeatedly where I only expect it to be fired once. See below for objects and behaviors. I have a control that contains...
0
by: Demosthenes | last post by:
I am using vs 2003, below is the callback method for my socket. The way I understand how all this works is: sockDataArrival gets started as a thread, and reads from the server using EndReceive. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.