|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Updating BindingSource.DataSource from non UI threadHello,
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. You can do this, as long as you make sure that it is not shown until the
other thread has finished. -- Show quoteHTH, Kevin Spencer Microsoft MVP Professional Numbskull Hard work is a medication for which there is no placebo. "peancor" <x@no.email> wrote in message news:Xns97AA6F47EAAABankor@216.196.109.144... > 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. Thank you!
Show quote "Kevin Spencer" <kevin@DIESPAMMERSDIEtakempis.com> wrote in news:#jHPhG6YGHA.3328@TK2MSFTNGP02.phx.gbl: > You can do this, as long as you make sure that it is not shown until > the other thread has finished. > |
|||||||||||||||||||||||