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

Event DataTable issue with Timer

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 updateDatagrid(object sender, DataTable dt)
{
if ( dataGrid1.InvokeRequired )
{
dataGrid1.Invoke(new DataGridEventHandler(this.updateDatagrid));
}
else
{
dataGrid1.DataSource = dt;
}

}

The issue is, that when this event is called from a System.Timers.Timer
event (in genData) the datagrid is not filled. However, when I call the
event manually it works fine. As you can see above I tried to decipher the
inner workings of Invoke but it hasnt helped.

This is a windows app .Net 1.1 framework.

I have been strugling with this strange issue all day, I hope someone can
help.
Thanks,
Anders
Nov 16 '05 #1
1 1305
Hi, I have somehow solved the problem. From From1 i refer the genData and
set the Timer to synchronize with the Form1 object:

genData.aTimer.SynchronizingObject = this;

If anyone has a better solution then please inform me.
Cheers,
Anders

"Anders" <no***@damnspam.com> wrote in message
news:eS**************@TK2MSFTNGP14.phx.gbl...
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 updateDatagrid(object sender, DataTable dt)
{
if ( dataGrid1.InvokeRequired )
{
dataGrid1.Invoke(new DataGridEventHandler(this.updateDatagrid));
}
else
{
dataGrid1.DataSource = dt;
}

}

The issue is, that when this event is called from a System.Timers.Timer
event (in genData) the datagrid is not filled. However, when I call the
event manually it works fine. As you can see above I tried to decipher the
inner workings of Invoke but it hasnt helped.

This is a windows app .Net 1.1 framework.

I have been strugling with this strange issue all day, I hope someone can
help.
Thanks,
Anders

Nov 16 '05 #2

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

Similar topics

13
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
6
by: Dan | last post by:
I've created a pocketpc app which has a startup form containing a listview. The form creates an object which in turn creates a System.Threading.Timer. It keeps track of the Timer state using a...
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...
2
by: Anders | last post by:
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...
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...
7
by: Raymond Lewallen | last post by:
Which would be the proper way or the reason for using any of the following or combinations of the following? These are the 3 ways I've figured I can do what I want to do, I just don't know which...
12
by: Jack Russell | last post by:
My unstanding of all VB up to and including vb6 is that an event could not "interrupt" itself. For instance if you had a timer event containing a msgbox then you would only get one message. ...
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...
3
by: Curious | last post by:
Hi, I have a program that gets the prices of stocks in real-time. The program consists of the following key components: // Constructor public GetRealTimeStockPrice() { // Step 1
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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?
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.