472,982 Members | 1,340 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,982 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 1567
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: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
2
by: giovanniandrean | last post by:
The energy model is structured as follows and uses excel sheets to give input data: 1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
4
NeoPa
by: NeoPa | last post by:
Hello everyone. I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report). I know it can be done by selecting :...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
4
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

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.