473,386 Members | 2,078 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,386 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 2185
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
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,...

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.