Is it possible that a thread that updates a grid give me problems? For some
reason, when the for loop is really big (30000+ rows in grid), I get "Object
reference not set to an instance of an object" or "External component has
thrown an exception" in some rows. And it always happens in the first few
records (rec. 30-40 when I'm stepping through the code or rec. 10-18 when
I'm not).
This is the code:
private void runProcess()
{
ThreadStart thr_markGrid = new ThreadStart(mar kAuditGrid);
Thread AZMThread = new Thread (thr_markGrid);
AZMThread.Start (); //starting the thread
}
private void markAuditGrid()
{
for(int i=0;i<iRows; i++) //iRows = 35000 - number of rows in grid
{
if(dataGrid_aud itAddress.IsSel ected(i) == true)
{
dataGrid_auditA ddress[i,5] = "MARKED";
}
}
} 4 1207
VM <vo******@yahoo .com> wrote: Is it possible that a thread that updates a grid give me problems?
Yes. A DataGrid is a UI control, and as ever, you shouldn't do anything
to the UI except within the UI thread.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
The reason I added this thread was so the application could respond to other
user events while the grid was beig updated. If I want to do this update
within the UI thread, how would you do it?
Any links that talk about working with the UI thread would be agreatly
appreciated.
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in message
news:MP******** *************** *@msnews.micros oft.com... VM <vo******@yahoo .com> wrote: Is it possible that a thread that updates a grid give me problems?
Yes. A DataGrid is a UI control, and as ever, you shouldn't do anything to the UI except within the UI thread.
-- Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet If replying to the group, please do not mail me too
VM <vo******@yahoo .com> wrote: The reason I added this thread was so the application could respond to other user events while the grid was beig updated. If I want to do this update within the UI thread, how would you do it?
If you're basically doing a lot of stuff to the UI (and changing up to
35000 rows is a lot of stuff) then it's going to take some time.
Any links that talk about working with the UI thread would be agreatly appreciated.
I don't have any links on hand, I'm afraid, although I'm sure there are
lots of pages around.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
do what you'd normally do w/o spinning off another thread. if you are concerned that your program will temporarily freeze while doing all that work, then maybe you should rethink about displaying 35000 rows in the UI. :
----- VM wrote: ----
The reason I added this thread was so the application could respond to othe
user events while the grid was beig updated. If I want to do this updat
within the UI thread, how would you do it
Any links that talk about working with the UI thread would be agreatl
appreciated
"Jon Skeet [C# MVP]" <sk***@pobox.co m> wrote in messag
news:MP******** *************** *@msnews.micros oft.com.. VM <vo******@yahoo .com> wrote Is it possible that a thread that updates a grid give me problems Yes. A DataGrid is a UI control, and as ever, you shouldn't do anythin to the UI except within the UI thread - Jon Skeet - <sk***@pobox.co m>> http://www.pobox.com/~skee If replying to the group, please do not mail me to This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Zuel |
last post by:
Sup everyone!
I wrote this code for Tomcat appserver but I am told from an
associate that it has threading issues. The basic idea is to store a
read only data table for everyone to use. It takes some time for the
table to be created. I want to store the table in a singleton and
update it periodicly, basicaly when a user logs into the system. By
keeping 1 table allocated I don't have to worry about memmory usage
and if a user does...
|
by: Jon Skeet [C# MVP] |
last post by:
Please excuse the cross-post - I'm pretty sure I've had interest in the
article on all the groups this is posted to.
I've finally managed to finish my article on multi-threading - at least
for the moment. I'd be *very* grateful if people with any interest in
multi-threading would read it (even just bits of it - it's somewhat
long to go through the whole thing!) to check for accuracy,
effectiveness of examples, etc.
Feel free to mail...
|
by: Stephan Steiner |
last post by:
Hi
I'm using several DataTables in my program which are updated periodically.
At the same I have those tables bound to DataGrids in my GUI. So far I've
been doing all the processing in the same program and the speed of the
processing prevented any issues when it comes to updating the GUI elements
(as DataTables are changed this triggers updates in the DataGrids), but as
soon as I add cpu time intensive processing options (i.e. receiving...
|
by: Tom B |
last post by:
I've written the code below to try and figure out how threading works.
My assumption is that when starting a new thread it would run at the same
time as the original thread.
Am I wrong?
I've made a simple form with two text labels and a button. When I click the
button, it creates a thread that updates one label, and the main code
updates the other label.
It appears that the created thread doesn't run until the main thread is
|
by: Elliot Rodriguez |
last post by:
Hi:
I am writing a WinForm app that contains a DataGrid control and a StatusBar
control. My goal is to update the status bar using events from a separate
class, as well as some other simple things.
The method I am writing queries a large dataset. As part of my feedback to
the user, I am updating the status bar when the connection is made and the
dataset is actually retrieved. The dataset retrieval method I have placed on
a separate...
| |
by: trialproduct2004 |
last post by:
Hi all
i am having application in C#.
here what i want it to update one datagrid depending on particular
value.
I want to start minimum of 5 threads at a time and all these threads
are updating datagrid in their thread proceudre.
What i want is whenever 5 threads are running as soon as one thread
finish its execution i want to asssing new thread proceudre to that
thread.
Can some one tell me how to do it?
|
by: John Richardson |
last post by:
I've been bothered for some time about my DataGrid not populating my rows
very quickly. I have about 10K rows loading into the grid.
I create a datatable dt with 2 columns, an ID and a display. The ID is a
member of the keys array.
I then create a DataView dv over the table, and sort it by Display and ID
column (in case of duplicate Display).
I then set my DataGrid.DataSource = dv;
I then load the datatable with my rows, and this is...
|
by: shumaker |
last post by:
I did have a save button for a datagrid that is bound to a
tableadapter, but I wanted to remove the button and instead save
updates everytime a user finishes editing a row. So I moved the update
code to the below RowLeave event. However, the problem I have is when
moving to the last new row, and then moving out, an attempt is made to
save the new row even if the user did not make any edits on it. When
using the save button before, if...
|
by: Ty |
last post by:
Hi all
Short version of my problem:
i have a Datagrid (Flexgrid from ComponentOne) with a Datatable as
source. I need to search a row in the datatable, using a primary key
column in the datatable, and then figure out wich row this currently
is in the Datagrid. This should probably be done using the currency
manager for speed reasons.
For the live of me, i can't figure out how to locate the row very fast
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
| |
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |