473,809 Members | 2,617 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Allowing access to controls from another thread

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??

Nick.
Feb 3 '06 #1
3 4761
"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

Feb 3 '06 #2
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...

CheckForIllegal CrossThreadCall s

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.

"Armin Zingler" <az*******@free net.de> wrote in message
news:e%******** ********@tk2msf tngp13.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

Feb 3 '06 #3
"NickP" <a@a.com> schrieb
Hi Armin,

Of course the operating system supports it, the control itself
can handle calls from another thread, that's simple enough to do.
It may work, but there's no guarantee. That's why I didn't mention
CheckForIllegal CrossThreadCall s because it's value is not True in vain.
I've just come across a property of one control called...

CheckForIllegal CrossThreadCall s

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.


It does not make much sense to put work in a separate thread if it's main
job is manipulating controls.
Armin

Feb 3 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
1868
by: WindAndWaves | last post by:
Hi Gurus I have recently discovered references in the VB section of MS Access, however, when choosing references, I noticed that there are more than who knows how many options. How and/or where do you i get more information on all the references available? Are there any that I should be using / should be avoiding (I know about the DAO stuff)? Keen to hear any suggestions.
14
2587
by: Mike | last post by:
I had a question about threading and access to private class variables. I am developing a windows service which has a class inside of it which will receive various asynchronous calls to it via delegates. Inside one method of the class (which is a private variable in my windows service), an ArrayList variable is modified by adding a new item to its list. Each time the method is called via an asynchronous delegate (from numerous...
1
2027
by: Mamatha | last post by:
Hi I have a small application in VB.NET,it consists of one form,one class and one module.I have declared one thread globally in module to execute the function in the form.I started that thread in a class. In that function of the form i had wrote code like that : Open a text file and reading contents from that file. Now i want to display that content into a text control of the form.But i was unable to display that.
2
1688
by: c676228 | last post by:
Hi, I created a group of user controls in an aspx form. which is as follow: <body> <form id="Form1" method="post" runat="server"> <SUBWAY:PEOPLEINFO id="Peopleinfo0" runat="server" Caption="Dependent Information"></SUBWAY:PEOPLEINFO> <p></p> <SUBWAY:PEOPLEINFO id="Peopleinfo1" runat="server" Caption="Dependent
22
6294
by: Jordan S. | last post by:
SQL Server will be used as the back-end database to a non trivial client application. In question is the choice of client application: I need to be able to speak intelligently about when one client (MS Access vs ..NET Windows Forms) would be preferred over the other. While I have some good arguments on both sides, I would appreciate your points of view on the topic.
16
11140
by: Neil | last post by:
I posted a few days ago that it seems to me that the Access 2007 rich text feature does not support: a) full text justification; b) programmatic manipulation. I was hoping that someone might know one way or the other whether that was true or not, or could point me to an article or help text that would. What I have seen so far online and in Access 2007 help seems to confirm the above. But that (or at least (b)) seems incredible that it...
64
4610
by: John | last post by:
Hello there, Im cursing my place of employment...and its taken me a month to realise it... The scenario: Ive just stepped into a role to migrate an access database to VB.Net. The access database runs on terminal services and supports approximatly 25-30 users. It is crapping out big time, corrupted data, changes to the front end are difficult for someone unfamiliar with the system (me), the table structure is bad...really bad....there is...
16
4179
by: Mike | last post by:
Hi, I have a form with some controls, and a different class that needs to modify some control properties at run time. Hoy can I reference the from so I have access to its controls and therefore being able to modify its properties?
4
4805
by: =?Utf-8?B?QWxoYW1icmEgRWlkb3MgS2lxdWVuZXQ=?= | last post by:
Hi misters, I have winForm that needs update Panel (add controls to Panel of SplitContainer dynamically). I have a Backgroundworker, and DoWork event I want to add controls but I get this error in Spanish (I don't get translation: Los controles creados en un subproceso no pueden tener controles primarios en un control en un subproceso diferente.)
0
9721
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10640
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10387
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5689
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.