473,387 Members | 1,492 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,387 software developers and data experts.

Forms.Timer - multithreaded?

Hi,

Does the System.Windows.Forms.Timer invoke the main form thread? Or does it
start another thread so that I need to lock my objects on which it operates
in case the user of the program saves data while the Timer updates data.

regards Jesper.
Jul 13 '08 #1
4 1580
On Sun, 13 Jul 2008 05:51:00 -0700, Jesper, Denmark
<Je***********@discussions.microsoft.comwrote:
Does the System.Windows.Forms.Timer invoke the main form thread? Or does
it
start another thread so that I need to lock my objects on which it
operates
in case the user of the program saves data while the Timer updates data.
From the main documentation page for the class: "This Windows timer is
designed for a single-threaded environment where UI threads are used to
perform processing"
Jul 13 '08 #2
Works on the form's thread.

Pete
Jul 13 '08 #3
Peter Morris wrote:
Works on the form's thread.
.... in contrast to System.Threading.Timer or System.Timers.Timer which both
raise their timing events on a worker thread. Getting the timing events in
the UI thread is the sole reason for the existence of
System.Windows.Forms.Timer.

-cd
Jul 14 '08 #4
Jesper,

First things first, you are violating the concept of timer by thinking to
execute that on a multi thread. thus it is not at all a practice to run the
timer on multi thread

Think once again.
"Jesper, Denmark" <Je***********@discussions.microsoft.comwrote in message
news:0E**********************************@microsof t.com...
Hi,

Does the System.Windows.Forms.Timer invoke the main form thread? Or does
it
start another thread so that I need to lock my objects on which it
operates
in case the user of the program saves data while the Timer updates data.

regards Jesper.

Jul 14 '08 #5

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

Similar topics

4
by: Bilo | last post by:
I have a Windows Forms Class MainGUI I have declared MainGUI maingui; public System.ComponentModel.Container components = new Container(); in the Class I call another class MediaDriver with...
2
by: Michael Evans | last post by:
First, we rely on a stable update rate so that our physics and dynamics calculations and integrations are based on a known interval and therefore are true-to-life. Second, the graphics positions...
15
by: Joshua Kendall | last post by:
I have a script in which it keeps opening the same form instead of only one instance. I also need help with a form that has a password. Where do I put the actual password? can I use a database for...
14
by: Mathieu | last post by:
Hi all, I just want to know how to use a System.Windows.Forms.Timer in class. I know how to use it on a form, but I don't know how to "put" a timer in a class (DLL) Thx !!!
8
by: Stephen Rice | last post by:
Hi, I have a periodic problem which I am having a real time trying to sort. Background: An MDI VB app with a DB on SQL 2000. I have wrapped all the DB access into an object which spawns a...
2
by: jajalc | last post by:
Hi all, WE have a windows service using .net and which uses a System.Timers.Timer..all the of code works fine..... but after a extended period of time the timer just stops firing the elasped...
3
by: | last post by:
Is it possible to have just a multithreaded sub procedure? What I need is a timer time_elapsed event (2 sec interval) send params to a sub that is multithreaded. I have a COM component used to...
8
by: =?Utf-8?B?RGF2ZQ==?= | last post by:
Is this possible? I have 3 forms frmGrandparent, frmParent & frmChild. Can frmGrandparent do a frmParent.ShowDialog() and then (while frmParent is open) do a frmChild.ShowDialog(). At the end of...
4
by: =?iso-8859-1?B?S2VyZW0gR/xtcvxrY/w=?= | last post by:
Hi, i have a main thread an another worker thread. The main Thread creates another thread and waits for the threads signal to continue the main thread. Everything works inside a ModalDialog and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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
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.