Updating BindingSource.DataSource from non UI thread

P

peancor

Hello,

I have an UserControl with a BindingSource linked to a datagrid.

if i create the control and show it in a form and then try to set the
DataSource property from a non-UI thread i get a CrossThreadException as
expected. But if I only Create the control whithout showing it and then
set the datasource property from a non-UI thread and then show the
control from the UI thread all seems to work fine.

The question is. Is that correct or can i get some unexpected
behaviour?.

I am trying to do this because setting the datasource takes a long time
and lets the ui thread irresponsive.
 
K

Kevin Spencer

You can do this, as long as you make sure that it is not shown until the
other thread has finished.

--
HTH,

Kevin Spencer
Microsoft MVP
Professional Numbskull

Hard work is a medication for which
there is no placebo.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top