G
Guest
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(this);
this.ExecuteCommandsThread = new Thread(new
ThreadStart(m_ExecuteThread.Go_Execution_AllTests));
this.ExecuteCommandsThread.Start();
In my thread Go_Execution_AllTests function start running and do something
until the following line code:
rootNode = (TreeNode)this.myForm.myTNodesPackage [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.Checked==false)
Any one can explain me why ? and what should I do ?
Why thread stopped ?
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(this);
this.ExecuteCommandsThread = new Thread(new
ThreadStart(m_ExecuteThread.Go_Execution_AllTests));
this.ExecuteCommandsThread.Start();
In my thread Go_Execution_AllTests function start running and do something
until the following line code:
rootNode = (TreeNode)this.myForm.myTNodesPackage [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.Checked==false)
Any one can explain me why ? and what should I do ?
Why thread stopped ?