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

Sort datagrid (ThreadSystem.NullReferenceException in system.windows.forms.dll)

Please help

I have the problem that when I change the data in a
Windows.Forms.DataGrid by a separate thread the following
Exception is thrown:

ThreadSystem.NullReferenceException in
system.windows.forms.dll

I can't catch this Exception and it only occurs when I
allow sorting in the grid and choose the changing column
to sort.

I tried several things like monitors, suspend layout etc.
but nothing helped.
In the Threads Window of Visual Studio I can see that
there is an extra thread with the highest priority. I
assume that this one do the sorting in the background and
causes this exception.

Is this a bug of the datagrid or not and has anybody a
suggestion to solve this problem?

I have written a small test application to reproduce this
behavior. If you are interested I can send it to you.

Thanks
Ben

Nov 20 '05 #1
3 2355
Hi Ben,

No takers with just the message. I reckon you're gonna have to send that
Project.

Regards,
Fergus
Nov 20 '05 #2
On 2003-10-30, mahtan <Be***********@hotmail.com> wrote:
Please help

I have the problem that when I change the data in a
Windows.Forms.DataGrid by a separate thread the following
Exception is thrown:

ThreadSystem.NullReferenceException in
system.windows.forms.dll

I can't catch this Exception and it only occurs when I
allow sorting in the grid and choose the changing column
to sort.

I tried several things like monitors, suspend layout etc.
but nothing helped.
In the Threads Window of Visual Studio I can see that
there is an extra thread with the highest priority. I
assume that this one do the sorting in the background and
causes this exception.

Is this a bug of the datagrid or not and has anybody a
suggestion to solve this problem?

I have written a small test application to reproduce this
behavior. If you are interested I can send it to you.

Thanks
Ben


Please do. But, I have to ask - are you trying to update the DataGrid
directly from the background thread? Because if you are, that is most
likely the source of your error. Windows forms controls are not thread
safe. All, except for 4, methods and properties must be called from the
GUI thread.

--
Tom Shelton
MVP [Visual Basic]
Nov 20 '05 #3
* Tom Shelton <to*@mtogden.com> scripsit:
Please do. But, I have to ask - are you trying to update the DataGrid
directly from the background thread? Because if you are, that is most
likely the source of your error. Windows forms controls are not thread
safe. All, except for 4, methods and properties must be called from the
GUI thread.


A good introduction to Windows Forms + Multithreading can be found here:

<http://www.devx.com/dotnet/Article/11358>

--
Herfried K. Wagner
MVP VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #4

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

Similar topics

0
by: wesley | last post by:
Hi all, I have been getting this frustating problem where my application keep throwing a NullReferenceException, but for the light of me I could not localise the location of the problem since it...
0
by: sarah | last post by:
Using .NET C# installed Framework 1.1 with Service Pack 1 I have a MDI application in C# that contains 3 different forms. Form 1 has several controls one of which is a DataGrid control that...
2
by: Tamlin | last post by:
Hi all, I'm getting a bug with the datagrid object. I've created one from scratch, bound it to a dataview with 2 int32 columns and formatted the output as currency. I've found that when you...
0
by: Shravan | last post by:
Hi, I have a Windows Forms Custom DataGrid, which is put in a usercontrol, which on setting DataSource is setting focus to grid. The call stack for setting the focus is as follows. This is not...
3
by: Ryan Liu | last post by:
Hi there, I got a NullReferenceException when delete last row in a datagrid. I had hard time to solve since it does not occur in my own code. I put a datagrid in my inherited user control,...
2
by: Raed Sawalha | last post by:
i have a windows form(Main) with listview, when click an item in listview i open other window form (Sub) which generate the selected item from parent window in as treeview items when click any item...
4
by: Steve | last post by:
I am fairly new to VB.NET, and I am rewriting an application I wrote a while back, also in VB.NET. I aplied some new things I learned. Anyway, here is my problem....... I have a custom DataGrid...
0
by: Becker | last post by:
I have a datatable that I use to display running processes. These running processes are spawned as different threads. I use the readerwriterlock class to ensure that when I write to the datatable,...
2
by: Flack | last post by:
I have a DataGrid and a DataTable. When my form loads I create the DataTable with the appropriate columns and use it for the DataGrids.DataSource. Later on in my app, I alter the DataTable: ...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
by: jimatqsi | last post by:
The boss wants the word "CONFIDENTIAL" overlaying certain reports. He wants it large, slanted across the page, on every page, very light gray, outlined letters, not block letters. I thought Word Art...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...

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.