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

DataGrid Cross Thread Access

TFS
Hi,

I know the topic of cross-thread operations from the UI has been addressed
several times, but if anyone could provide some insight for my particular
scenario, I would be thankful...

Using Visual Basic (VS 2005 Beta 1)

In a Public class X, I have a TCP connection setup to parse and dump data
into a DataTable

On a Windows form I have a DataGrid and a button. When I click the button, a
new instance of the class X is created, the TCP connection is opened, and the
DataGrid's DataSource property is set to the the DataTable of class X.

I'm getting an 'Illegal Cross thread operation' being thrown from the class
saying that the DataGrid is being accessed on a thread other than the one it
was created on.

How do I code for this (seemingly simple) scenario?

Much thanks,

-Todd
--
Management Analytics, Inc.
http://ManagementAnalytics.com
Nov 21 '05 #1
2 1264
Hi,

http://msdn.microsoft.com/msdnmag/is...asicInstincts/

Ken
-------------------
"TFS" <Todd "at" ManagementAnalytics "dot" com> wrote in message
news:A7**********************************@microsof t.com...
Hi,

I know the topic of cross-thread operations from the UI has been addressed
several times, but if anyone could provide some insight for my particular
scenario, I would be thankful...

Using Visual Basic (VS 2005 Beta 1)

In a Public class X, I have a TCP connection setup to parse and dump data
into a DataTable

On a Windows form I have a DataGrid and a button. When I click the button, a
new instance of the class X is created, the TCP connection is opened, and
the
DataGrid's DataSource property is set to the the DataTable of class X.

I'm getting an 'Illegal Cross thread operation' being thrown from the class
saying that the DataGrid is being accessed on a thread other than the one it
was created on.

How do I code for this (seemingly simple) scenario?

Much thanks,

-Todd
--
Management Analytics, Inc.
http://ManagementAnalytics.com
Nov 21 '05 #2
TFS.

Be aware that the result of your thread in this case is only that it takes
some more time, however your user has the change to close the application.
(If you have set the right properties for that).

Than you can in my opinion create a seperated new dataset which you have
placed modaly and set that as the new datatasource when the thread ends.

Another option is in my opinion by first setting the datagrid.datasource to
nothing.

I hope this helps,

Cor

Nov 21 '05 #3

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

Similar topics

3
by: Thomas | last post by:
hi, - I use the datagrid without a real database, only to display my memory data and it works fine. - If I install the application at an other computer the datagrid doesn't work and disappear,...
1
by: Sean | last post by:
What is the best way to access the Underlying data of a DataGrid. I have two SQL tables joined and display some data from both, but I want to be able to on clicking of a row bring up a form that...
0
by: Bob Davies | last post by:
Hi I have a webservice that retrieves data from a database, this is then returned to the calling client application built in windows forms within a dataset, however upon attempting to create...
8
by: Pieter | last post by:
Hi, I'm having some weird problem using the BackGroundWorker in an Outlook (2003) Add-In, with VB.NET 2005: I'm using the BackGroundWorker to get the info of some mailitems, and after each item...
3
by: jlamanna | last post by:
I was wondering if there was a utility that could tell you when your C# application is making cross-apartment COM calls. I have a fairly large application that makes extensive use of a 3rd party...
9
by: Tony Girgenti | last post by:
Hello. I'm developing and testing a web application using VS.NET 2003, VB, .NET Framework 1.1.4322, ASP.NET 1.1.4322 and IIS5.1 on a WIN XP Pro, SP2 computer. I'm using a web form. For a...
5
by: nospam | last post by:
Hi all. I have encountered a "Cross-thread operation not valid" error in a test program I created and although I have came up with a solution I don't like the performance of the program. I...
3
by: Jonathan | last post by:
In one of the 4 output columns of my Datagrid, I have a Yes/No Boolean field. I'd like to show a graphical tick (e.g. tick.jpg) or a cross e.g. (cross.jpg) instead of True/False or Yes/No. ...
0
by: Peter Duniho | last post by:
On Mon, 02 Jun 2008 17:14:31 -0700, NvrBst <nvrbst@gmail.comwrote: The general rule is that if it's not one of the five members listed in the docs (under Control.Invoke and other pages), you...
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
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.