473,325 Members | 2,442 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,325 software developers and data experts.

A real time updating interface

Hello, I'm a Java programmer and I'm new to C# (I've read something but
I've no real programming experience). I'm programming a form that
displays some data from an external source (i.e. a com port) ad
displays it. The updating cycle is about every second. The windows form
has a few controls.

In Java there is the swing Timer class that implements a worker thread
that is activated every n millisec and is synchronized with the
interface event threads. Is there something similar in C#? Any example?
Thank you very much.

Oct 17 '06 #1
5 3141

Beorne wrote:
Hello, I'm a Java programmer and I'm new to C# (I've read something but
I've no real programming experience). I'm programming a form that
displays some data from an external source (i.e. a com port) ad
displays it. The updating cycle is about every second. The windows form
has a few controls.

In Java there is the swing Timer class that implements a worker thread
that is activated every n millisec and is synchronized with the
interface event threads. Is there something similar in C#? Any example?
Thank you very much.
If you're using .NET 2.0 I suggest you take a look at BackgroundWorker
(http://msdn2.microsoft.com/en-us/lib...undworker.aspx)
If you don't like this approach, or, want to accomplish this by your
own hand (to improve your knowledge about C# and .NET) take a look at
this very simple example
http://dotnetjunkies.com/WebLog/bben...29/137586.aspx.
The examples above may give you an introduction to the subject.

HTH

Oct 17 '06 #2

Beorne wrote:
In Java there is the swing Timer class that implements a worker thread
that is activated every n millisec and is synchronized with the
interface event threads. Is there something similar in C#? Any example?
Thank you very much.
Beorne,

The System.Windows.Forms.Timer and System.Timers.Timer can both be
synchronized with the main UI thread.

Brian

Oct 17 '06 #3

Brian Gideon wrote:
Beorne wrote:
In Java there is the swing Timer class that implements a worker thread
that is activated every n millisec and is synchronized with the
interface event threads. Is there something similar in C#? Any example?
Thank you very much.

Beorne,

The System.Windows.Forms.Timer and System.Timers.Timer can both be
synchronized with the main UI thread.

Brian
How could I synchronize the Windows.Forms.Timer with the main UI
Thread?

Thanks!

Oct 27 '06 #4

Beorne wrote:
Brian Gideon wrote:
Beorne,

The System.Windows.Forms.Timer and System.Timers.Timer can both be
synchronized with the main UI thread.

Brian

How could I synchronize the Windows.Forms.Timer with the main UI
Thread?

Thanks!
I wasn't very clear. Actually, the System.Windows.Forms.Timer is
always synchronized with the UI thread. The System.Timers.Timer can
either use the UI thread or a ThreadPool thread depending on how the
SynchronizingObject property is set.

Brian

Oct 27 '06 #5

Brian Gideon wrote:
Beorne wrote:
Brian Gideon wrote:
Beorne,
>
The System.Windows.Forms.Timer and System.Timers.Timer can both be
synchronized with the main UI thread.
>
Brian
How could I synchronize the Windows.Forms.Timer with the main UI
Thread?

Thanks!

I wasn't very clear. Actually, the System.Windows.Forms.Timer is
always synchronized with the UI thread. The System.Timers.Timer can
either use the UI thread or a ThreadPool thread depending on how the
SynchronizingObject property is set.

Brian
The choiche is very simple, i'm developing on Compact Framework and
System.Timers.Timer is not supported.
Thanks!

Oct 30 '06 #6

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

Similar topics

22
by: MJR | last post by:
Hi, just wondering what options I would have if I wanted to use Python to produce real-time graphs. Is there any plotting package suitable for this. Thanks, Mike
18
by: Ken | last post by:
Hi. Can anyone refer me to any articles about the compatibility between c++ polymorphism and real-time programming? I'm currently on a real-time c++ project, and we're having a discussion...
12
by: Russ | last post by:
I'm interested in setting up a web page where live data can be displayed in real-time on the web page. For example: I would like to display a (nice looking) graph of some data value versus time...
175
by: Ken Brady | last post by:
I'm on a team building some class libraries to be used by many other projects. Some members of our team insist that "All public methods should be virtual" just in case "anything needs to be...
2
by: Colli | last post by:
Hi: I need to setup a continuously updating system Date/Time in my user interface. I can get the system date/time and can cause it to update with a button-click but I can't seem to figure out how...
34
by: Guch Wu | last post by:
Boost has many terrific libraries. But I want to know whether they are ready for using in real projects. Which of them are mature enough, or just only in progress?
10
by: Martin Hughes | last post by:
Hi guys, I was wondering if anyone could give me some advice. I am looking to develop an ASP.NET application that will enable several workstations to access real time telemetry data received...
15
by: (PeteCresswell) | last post by:
Some time within the next nine months, there's a pretty good chance I'll have the "opportunity" to port a bond trading system that I wrote - whose front end is currently MS Access - to .NET. ...
2
by: Blubaugh, David A. | last post by:
To All, I have done some additional research into the possibility of utilizing Python for hard real time development. I have seen on various websites where this has been discussed before on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.