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

Thread filling DataSet bounded to DataGrid with my own DataGridCol

I have such a problem… I have create my custom DataGridColumn inheriting from
System.Windows.Forms.DataGridColumnStyle on using it on DataGrid, to show
rows painted by me self. Because dates taken from database are very large,
and filling DataSet bounded to this DataGrid takes some time, a decided to
put fill logic into new thread. And so method running in this thread clears
only this DataSet bounded to DataGrid and fills it once more time using
SqlDataAdapter. The user have got “Refresh” button, so he could fire this
Thread. And there is a problem. When I call this method, there are same
strange things going with my application… in almost cases DataGrid shows to
scroll bars, any of them aren’t active, they don’t response for moving, or
click up, down buttons, there aren’t any showing dates in my DataGrid…
sometimes application blokes, or throwing unhandled exception…
Any suggestions… ???

Regards…

Krzysztof Karnicki

Nov 16 '05 #1
1 2178
The problem is, when the thread is filling the dataset, the dataset is firing events to the datagrid and these are arriving ont the background thread. So your UI is being updated on a background thread which is unsupported in the underlying windowing system Create another dataset, then use the BeginInvoke method of the datagrid to marchal a call oin to the UI thread that rebinds the datagrid to the new dataset.

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

I have such a problem… I have create my custom DataGridColumn inheriting from
System.Windows.Forms.DataGridColumnStyle on using it on DataGrid, to show
rows painted by me self. Because dates taken from database are very large,
and filling DataSet bounded to this DataGrid takes some time, a decided to
put fill logic into new thread. And so method running in this thread clears
only this DataSet bounded to DataGrid and fills it once more time using
SqlDataAdapter. The user have got "Refresh" button, so he could fire this
Thread. And there is a problem. When I call this method, there are same
strange things going with my application… in almost cases DataGrid shows to
scroll bars, any of them aren't active, they don't response for moving, or
click up, down buttons, there aren't any showing dates in my DataGrid…
sometimes application blokes, or throwing unhandled exception…
Any suggestions… ???

Regards…

Krzysztof Karnicki
Nov 16 '05 #2

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

Similar topics

3
by: Diego TERCERO | last post by:
Hi... I'm working on a tool for editing text resources for a family of software product my company produces. These text resources are found in a SQL Server database, in a table called...
2
by: wackyphill | last post by:
I have a long running query. I want the results in a DataGrid. I'd like the grid and form to be responsive and fill up w/ rows as the result set is read into a dataset that is the datasource of the...
1
by: magic man via .NET 247 | last post by:
hi everyone i have a c# application that uses multithreading toconnect to sql server and execute a stored procedure on theserver. i am using a dataset,sqlcommand,dataadapter and adatagrid to carry...
7
by: Mythran | last post by:
Been 11 days since I posted this and 0 replies (although, in OE, it looks like there was 1 but it's just another post with the same subject as before): Part #1: I have a Thread, MainThread, and...
4
by: gillcleeren | last post by:
I have a datagrid that has to be filled in a WinForms application. The data comes from an Oracle database. The normal procedure would be filling a dataset, but I have the problem that there are...
3
by: Tlink | last post by:
I have a master control program that needs to run continuously, accepting data and updating a datagrid for the user. As a result I have setup 2 threads, one accepts and processes incoming requests...
1
by: WayneM | last post by:
I have compact framework app that I was trying to test out on a windows form, but I cannot get past the very first step of simply filling a DataGrid from a DataSet. My code is Dim sqlStmt As...
2
by: Carl Heller | last post by:
Working in VS2003, .Net 1.1 I'm working on a project where I compare data between two databases. This is a lengthy process, and very data intensive, so I decided to create a class, and thread...
2
by: machado | last post by:
Greetings. I have a program in VB2008 and I need to execute a thread from differents Subs. Each time I start the thread I want to cancel the previous. Here an example: Private Sub...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.