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

invoke problems

Hi

I have a network program that fills 4 datatables while receiving data bursts
and which should then show those tables in 4 datagrids. The main GUI class
contains event callbacks for events that the receiver thread throws when
it's being activated and deactivated (handler_BroadcastStart, and
handler_EndOfBroadcast):

private void handler_BroadcastStart()
{
options.receiverActive = true;
options.Invoke(new EventHandler(options.updateGUI));
this.receiverActive = true;
this.dataGrid1.Invoke(new EventHandler(updateGUI));
Application.DoEvents();
}

private void handler_EndOfBroadcast()
{
options.receiverActive = false;
options.Invoke(new EventHandler(options.updateGUI));
this.receiverActive = false;
this.dataGrid1.Invoke(new EventHandler(updateGUI));
Application.DoEvents();
}

The main GUI form contains one datagrid, which is bound and unbound to the
datasource (I've tried suspending databindings several times in vain.. maybe
you've some of my other posts to these newsgroups). Here's the code I use
to show the data when the receiver is not active.

public void updateGUI(object sender, EventArgs e)
{
if (this.receiverActive)
dataGrid1.DataSource = null;
else
this.display(handler.manager.getRecords());
}
public void display(DataTable table)
{
this.table = table;
view = new DataView(this.table, "", "ID ASC",
DataViewRowState.CurrentRows);
this.dataGrid1.DataSource = view;
}

This works just as it should. Now my form to display several options (called
options) contains the other three Datagrids and I try to activate and
deactivate them using a very similar mechanism. You've already seen the
option.Invoke call above, and here's the updateGUI method of the options
form:

public void updateGUI(object sender, EventArgs e)
{
if (this.receiverActive)
{
dataGrid1.DataSource = null;
dataGrid2.DataSource = null;
dataGrid3.DataSource = null;
}
else
{
this.dataGrid1.DataSource = new DataView(stats.packetsReceived, "", "seqNo
ASC",
DataViewRowState.CurrentRows);
this.dataGrid2.DataSource = new DataView(stats.missingPackets, "", "ID
ASC",
DataViewRowState.CurrentRows);
this.dataGrid3.DataSource = stats.completionPercentages;
this.update();
}
}

The problem is, nulling the DataSource works, but binding it again locks up
the GUI. The program is still running, but neither the main GUI form, nor
the options form are accessible anymore and I have to kill them via the task
manager. I've also tried to call Invoke on the 3 datagrids in the options
form directly, without any success, as well as manipulating the DataSource
of those 3 datagrids in the UpdateGUI method of the main GUI class.. all
without success. Any ideas how I can handle those 3 datagrids in my 2nd form
just like the main datagrid?

Regards
Stephan Steiner
Nov 15 '05 #1
0 2950

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

Similar topics

10
by: Charles Law | last post by:
I have a user control created on the main thread. Let's say, for arguments sake, that it has a single property that maintains a private variable. If I want to set that property from a worker...
4
by: Ben Reese | last post by:
Simplified. I have 2 forms running on seperate threads (and message queues) I am having some odd problems with with the form on the second Thread/message queue freezing and/or dyinig, seemingly at...
1
by: boxim | last post by:
hi all, I'm having a few problems whereby my application is hanging when using the Invoke method of a form's control. Basically, when a user clicks a button on the form, it calls a remote...
3
by: Zürcher See | last post by:
I'm using the following structure for my programm, and I never had problems. Now by the invoke of the MyObject_End eventhandler I get the following error: System.Windows.FormsSpecified cast is...
4
by: Ben Reese | last post by:
Simplified. I have 2 forms running on seperate threads (and message queues) I am having some odd problems with with the form on the second Thread/message queue freezing and/or dyinig, seemingly at...
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
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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.