473,387 Members | 1,798 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.

Calling Event (sending Datatable) in Timer event problem!

Hi all,

I have two classes: Form1 and GrabTitle

Form1 instantiates GrabTitle

In GrabTitle there is a Timer event which calls several events in Form1. The
strange thing is that one event works while another doesnt.

The event transfering a text string works while another transfering a
DataTable do not! If I run the Timer event manually then it everything
works.

Any idea are much appreciated. I havent been able to find any similar issues
online (google)

Anders
Nov 16 '05 #1
2 1719
Anders,

What kind of timer are you using? If you are using a Timer from the
System.Timers namespace, then the timer callback will come back on a thread
most likely different from the UI thread, and you will have to marshal the
call back to the UI thread (through a call to the Invoke method on the
control).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Anders" <no***@damnspam.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi all,

I have two classes: Form1 and GrabTitle

Form1 instantiates GrabTitle

In GrabTitle there is a Timer event which calls several events in Form1.
The strange thing is that one event works while another doesnt.

The event transfering a text string works while another transfering a
DataTable do not! If I run the Timer event manually then it everything
works.

Any idea are much appreciated. I havent been able to find any similar
issues online (google)

Anders

Nov 16 '05 #2
Thanks Nicholas, this put me in the right direction. I have found a very
descriptive article about the subject:
http://weblogs.asp.net/justin_rogers...es/126345.aspx

Now I should be able to fix it once I understand the logic.

cheers,
Anders

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:uT**************@TK2MSFTNGP11.phx.gbl...
Anders,

What kind of timer are you using? If you are using a Timer from the
System.Timers namespace, then the timer callback will come back on a
thread most likely different from the UI thread, and you will have to
marshal the call back to the UI thread (through a call to the Invoke
method on the control).

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Anders" <no***@damnspam.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
Hi all,

I have two classes: Form1 and GrabTitle

Form1 instantiates GrabTitle

In GrabTitle there is a Timer event which calls several events in Form1.
The strange thing is that one event works while another doesnt.

The event transfering a text string works while another transfering a
DataTable do not! If I run the Timer event manually then it everything
works.

Any idea are much appreciated. I havent been able to find any similar
issues online (google)

Anders


Nov 16 '05 #3

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

Similar topics

2
by: VMI | last post by:
I'm trying to some dynamic searching to my windows Form so I added code in my TextBox.TextChanged so that, after every text change, a search is done to a datatable. So if I want to type the string...
1
by: Anders | last post by:
Hi again, I have two classes Form1 and GenData. Form1 creates an instance of genData. genData populates a Datatable and then sends it to Form1 using the event seen below:. private void...
20
by: Bob Day | last post by:
Using VS 2003, VB, MSDE... There are two threads, A & B, that continously run and are started by Sub Main. They instantiationsl of identical code. Thread A handles call activity on telephone...
10
by: amiga500 | last post by:
Hello, I have one basic simple question. When I have multiple records in the datagrid as follows: Code Product 1 Product 2 Product 3 11111 A B C...
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: 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?
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,...

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.