By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,238 Members | 1,804 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,238 IT Pros & Developers. It's quick & easy.

Thread filling DataSet bounded to DataGrid with my own DataGridCol

P: n/a
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
Share this Question
Share on Google+
1 Reply


P: n/a
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 discussion thread is closed

Replies have been disabled for this discussion.