|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Allowing access to controls from another threadHi there,
This might sound like a stupid question but this whole exception being thrown when accessing user controls from another thread is extremely over the top! Just looking at the index property of a listviewitem from another thread throws an exception! Is there any way to allow these as invoking the host thread to do the work is going to really slow things down unless I change the architechture completely. Wouldn't it have made sense to have an option to make the control invoke itself rather than raising an exception?? Maybe I'm missing the point I understand that there may be consequences, but surely cant we decide that ourselves?? Nick.
Show quote
Hide quote
"NickP" <a@a.com> schrieb No, because it's not supported by the OS. Where's the problem if you have to > Hi there, > > This might sound like a stupid question but this whole exception > being thrown when accessing user controls from another thread is > extremely over the top! > > Just looking at the index property of a listviewitem from another > thread throws an exception! Is there any way to allow these as > invoking the host thread to do the work is going to really slow > things down unless I change the architechture completely. Wouldn't > it have made sense to have an option to make the control invoke > itself rather than raising an exception?? Maybe I'm missing the > point > > I understand that there may be consequences, but surely cant we > decide that ourselves?? use BeginInvoke to have the UI thread do something? Armin Hi Armin,
Of course the operating system supports it, the control itself can handle calls from another thread, that's simple enough to do. I've just come across a property of one control called... CheckForIllegalCrossThreadCalls The problem I have with invoking is that with the current architechture of my control if I were to simply use this as necessary it would cause the host thread to perform the tasks that the worker thread was designed to do. I haven't had any problems as yet with this control being manipulated from another thread. Indeed if this is the shape of things to come then I should create a new control anyway, which I have just started, but it's still time. Anyway, I'm going to carry on, and check this property out too to see if it's in the control im trying to re-write. Thanks for your help! nick. Show quoteHide quote "Armin Zingler" <az.nospam@freenet.de> wrote in message news:e%23TP8jNKGHA.3272@tk2msftngp13.phx.gbl... > "NickP" <a@a.com> schrieb >> Hi there, >> >> This might sound like a stupid question but this whole exception >> being thrown when accessing user controls from another thread is >> extremely over the top! >> >> Just looking at the index property of a listviewitem from another >> thread throws an exception! Is there any way to allow these as >> invoking the host thread to do the work is going to really slow >> things down unless I change the architechture completely. Wouldn't >> it have made sense to have an option to make the control invoke >> itself rather than raising an exception?? Maybe I'm missing the >> point >> >> I understand that there may be consequences, but surely cant we >> decide that ourselves?? > > > No, because it's not supported by the OS. Where's the problem if you have > to use BeginInvoke to have the UI thread do something? > > > Armin "NickP" <a@a.com> schrieb It may work, but there's no guarantee. That's why I didn't mention > Hi Armin, > > Of course the operating system supports it, the control itself > can handle calls from another thread, that's simple enough to do. CheckForIllegalCrossThreadCalls because it's value is not True in vain. > I've just come across a property of one control called... It does not make much sense to put work in a separate thread if it's main> > CheckForIllegalCrossThreadCalls > > The problem I have with invoking is that with the current > architechture of my control if I were to simply use this as > necessary it would cause the host thread to perform the tasks that > the worker thread was designed to do. job is manipulating controls. Armin
Search Arraylist in Arraylist.
Saving a Database to Disk PropertyBag in VB.NET? PostMessage and Combobox Question about Control Collection in VB.net Windows Form Application Help Cast from string "" to type 'Date' is not valid Accessing controls from another thread project source design question Executing a DTS package |
|||||||||||||||||||||||