473,769 Members | 2,134 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reading access component from other thread.(thread stopped excepti

I have some unreasonable issue while reading access component from other
thread.
I have a Form class which includes TreeView, this tree view includes some
TreeNodes , lets say 2 .
In my Form class I define an arraylist which include reference to those
TreeNodes.

ArayList myTNodesPackage (define ...)
myTNodesPackage .Add….

Now I have:
myTNodesPackage[0] = treeNode1
myTNodesPackage[2] = treeNode2
I create tread and start it as following:
// ExecuteThread thread Class
m_ExecuteThread = new ExecuteThread(t his);
this.ExecuteCom mandsThread = new Thread(new
ThreadStart(m_E xecuteThread.Go _Execution_AllT ests));
this.ExecuteCom mandsThread.Sta rt();

In my thread Go_Execution_Al lTests function start running and do something
until the following line code:

rootNode = (TreeNode)this. myForm.myTNodes Package [0];
Now I can see that this access cause somtiong since my debug start respond
sloly.I see that rootNode.Text is OK but all other properties are not
available "error : cannot obtain value".

If I continue debugging the following code I will get an exception "Thread
was being stoped." .
if(rootNode.Che cked==false)

Any one can explain me why ? and what should I do ?
Why thread stopped ?
Nov 17 '05 #1
3 2149
=?Utf-8?B?W1lvc2ld?= <Yo**@discussio ns.microsoft.co m> wrote in
news:40******** *************** ***********@mic rosoft.com:
I have some unreasonable issue while reading access component
from other thread.
I have a Form class which includes TreeView, this tree view
includes some TreeNodes , lets say 2 .
In my Form class I define an arraylist which include reference
to those TreeNodes.

ArayList myTNodesPackage (define ...)
myTNodesPackage .Add….

Now I have:
myTNodesPackage[0] = treeNode1
myTNodesPackage[2] = treeNode2
I create tread and start it as following:
// ExecuteThread thread Class
m_ExecuteThread = new ExecuteThread(t his);
this.ExecuteCom mandsThread = new Thread(new
ThreadStart(m_E xecuteThread.Go _Execution_AllT ests));
this.ExecuteCom mandsThread.Sta rt();

In my thread Go_Execution_Al lTests function start running and do
something until the following line code:

rootNode = (TreeNode)this. myForm.myTNodes Package [0];
Now I can see that this access cause somtiong since my debug
start respond sloly.I see that rootNode.Text is OK but all other
properties are not available "error : cannot obtain value".

If I continue debugging the following code I will get an
exception "Thread was being stoped." .
if(rootNode.Che cked==false)

Any one can explain me why ? and what should I do ?
Why thread stopped ?


Yosi,

Only the form's thread, or a thread it starts thru Invoke or BeginInvoke,
can modify a visual control.

http://msdn.microsoft.com/library/de...ms06112002.asp
--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/
Nov 17 '05 #2
I know that read access is avialable from another threades but write is not
accessable.
And also I know that this in framewark 2 not 1.1.
thanks for helping.

"Chris R. Timmons" wrote:
=?Utf-8?B?W1lvc2ld?= <Yo**@discussio ns.microsoft.co m> wrote in
news:40******** *************** ***********@mic rosoft.com:
I have some unreasonable issue while reading access component
from other thread.
I have a Form class which includes TreeView, this tree view
includes some TreeNodes , lets say 2 .
In my Form class I define an arraylist which include reference
to those TreeNodes.

ArayList myTNodesPackage (define ...)
myTNodesPackage .Add….

Now I have:
myTNodesPackage[0] = treeNode1
myTNodesPackage[2] = treeNode2
I create tread and start it as following:
// ExecuteThread thread Class
m_ExecuteThread = new ExecuteThread(t his);
this.ExecuteCom mandsThread = new Thread(new
ThreadStart(m_E xecuteThread.Go _Execution_AllT ests));
this.ExecuteCom mandsThread.Sta rt();

In my thread Go_Execution_Al lTests function start running and do
something until the following line code:

rootNode = (TreeNode)this. myForm.myTNodes Package [0];
Now I can see that this access cause somtiong since my debug
start respond sloly.I see that rootNode.Text is OK but all other
properties are not available "error : cannot obtain value".

If I continue debugging the following code I will get an
exception "Thread was being stoped." .
if(rootNode.Che cked==false)

Any one can explain me why ? and what should I do ?
Why thread stopped ?


Yosi,

Only the form's thread, or a thread it starts thru Invoke or BeginInvoke,
can modify a visual control.

http://msdn.microsoft.com/library/de...ms06112002.asp
--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/

Nov 17 '05 #3
NO, you should not "access" UI elements (except menu's) from another thread
than the thread that created the UI elements.
And here "access" means reading and writing! And it doesn't matter wheter
you are using 1.1 or 2.0 it's not due to .NET it's imposed by Windows
itself.
Willy.

"[Yosi]" <Yo**@discussio ns.microsoft.co m> wrote in message
news:4E******** *************** ***********@mic rosoft.com...
I know that read access is avialable from another threades but write is not
accessable.
And also I know that this in framewark 2 not 1.1.
thanks for helping.

"Chris R. Timmons" wrote:
=?Utf-8?B?W1lvc2ld?= <Yo**@discussio ns.microsoft.co m> wrote in
news:40******** *************** ***********@mic rosoft.com:
> I have some unreasonable issue while reading access component
> from other thread.
> I have a Form class which includes TreeView, this tree view
> includes some TreeNodes , lets say 2 .
> In my Form class I define an arraylist which include reference
> to those TreeNodes.
>
> ArayList myTNodesPackage (define ...)
> myTNodesPackage .Add….
>
> Now I have:
> myTNodesPackage[0] = treeNode1
> myTNodesPackage[2] = treeNode2
> I create tread and start it as following:
> // ExecuteThread thread Class
> m_ExecuteThread = new ExecuteThread(t his);
> this.ExecuteCom mandsThread = new Thread(new
> ThreadStart(m_E xecuteThread.Go _Execution_AllT ests));
> this.ExecuteCom mandsThread.Sta rt();
>
> In my thread Go_Execution_Al lTests function start running and do
> something until the following line code:
>
> rootNode = (TreeNode)this. myForm.myTNodes Package [0];
> Now I can see that this access cause somtiong since my debug
> start respond sloly.I see that rootNode.Text is OK but all other
> properties are not available "error : cannot obtain value".
>
> If I continue debugging the following code I will get an
> exception "Thread was being stoped." .
> if(rootNode.Che cked==false)
>
> Any one can explain me why ? and what should I do ?
> Why thread stopped ?


Yosi,

Only the form's thread, or a thread it starts thru Invoke or BeginInvoke,
can modify a visual control.
http://msdn.microsoft.com/library/de...ms06112002.asp
--
Hope this helps.

Chris.
-------------
C.R. Timmons Consulting, Inc.
http://www.crtimmonsinc.com/

Nov 17 '05 #4

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

Similar topics

12
1788
by: Chien Lau | last post by:
I had a situation occur today that's happened a number of times before and I'd like to get your take on it: Imagine... You're developing a WinForms app for a client that includes the use charts. So you purchase a .NET charting component, design the app, and deliver it to the customer. One year later, the customer comes back and says, "There's a bug in your app. The application crashes when I do such and such to the chart." I start...
1
6761
by: Magnus | last post by:
allrite folks, got some questions here... 1) LAY-OUT OF REPORTS How is it possible to fundamentaly change the lay-out/form of a report in access? I dont really know it that "difficult", but listen up; Reports, the way I look at them, all present data downwards, in this way; TITLE data
7
2608
by: Ford Prefect alias Armin | last post by:
I want to start a Thread and wait till the Thread has been stopped (via Suspend) How to do this. Sub Test Start Thread Wait Till Stopped Go on with this code as sone as the Thread has stopped.
2
1371
by: Jerry Spence1 | last post by:
I'm having a problem with the following excerpt: dim tcpCli As New TcpClient Dim ns As NetworkStream = tcpCli.GetStream Dim sw As New StreamWriter(ns, System.Text.Encoding.Default) Dim sr As New StreamReader(ns)
22
37752
by: Brett | last post by:
I have a second thread, t2, that errors out and will stop. It's status is then "Stopped". I try to start t2 from thread 1, t1, by checking If t2.threadstate = "Stopped" Then t2.start() However, this throws and error: System.Threading.ThreadStateException: Thread is running or terminated; it can not restart.
5
9580
by: Dave A | last post by:
I have an application that does lots of socket communications all asynchronously via the TcpClient class. The code has been working 99.9999% of the time (yeah one of those bugs) but occasionally the receiving thread would get 'stuck'. The pattern that I have used from the reading is quite common... AutoResetEvent waitForReadToComplete; NetworkStream stream; .... code to start the socket, send some data and then read the data by...
52
9983
by: Neil | last post by:
We are running an Access 2000 MDB with a SQL 7 back end. Our network guy is upgrading to Windows Server 2003 and wants to upgrade Office and SQL Server at the same time. We're moving to SQL Server 2005, and, since he already has licenses for Office Pro 2002, he wants to upgrade to that. I've been saying that we need to upgrade to Access 2003, not 2002, even if Office is kept at 2002. We are also looking to do a fair amount of...
1
7491
by: M Irfan | last post by:
Hello all, Recently I have started working in .NET 2.0. I am developing a web service application that references a DLL component written in C# 2.0. The component has its own config file which contains settings related to business logic coded in that component. I can reference and load the component but unable to read load the custom config file of that component. I know that the same thing is possible if my host application is any Exe...
4
2107
by: Shark | last post by:
Hi, I need a help. My application reads data from COM port, this data is then parsed and displyed on: 1. two plotters 2. text box. I'm using Invoke method to update UI when new data is received (through delegate).
0
9589
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
10049
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...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8873
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
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5310
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
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3965
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3565
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.