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 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?
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?
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?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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 &
|
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...
|
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...
|
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...
|
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,...
|
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...
|
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...
|
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...
|
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. ...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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...
|
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,...
|
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...
| |