Hi,
In VS 2005 Desinging Microsoft Take care abot the major issue. Thread
Synchnization is also change a lot from the 2003 to the 2005 VS.
Actuall when the programm executed, system assign the one thread for
the entire GUI creation and take the changes on the GUI, that will be
[STA Thread]. That thread has the only permission to take the changes
and control the other GUI elements creataed by the STA thraed. If u
create a another threads with the use of System.Threadding.thread,
these thread are not have a enoff previliges to change the GUI elements
on the forms. So u need to write the delegaes from the main thread and
call the delegate function from u r chaild threads, By using this
method u can solve this problem .
public delegate void AddnewTextDelegate(string str);
public void AddTextToTextBox(string str)
{
if (this.textBox1.InvokeRequired)
{
this.Invoke(new AddnewText(AddTextToTextBox), str);
}
else
{
this.textBox1.Text += str;
}
}
The Above exampele shows the add the test to the TextBox in the form.
In the Thread Function just call the AddTextToTextBox("string")
function.
It First call to the Function, In that it check whether the thread has
the certain previlizes or not, If it has it directly add the text to
the textbox, Other wise it again assing the task to the main thread...
All the Best ...
I hope that .. This is inforamtion is reliable ..
On Nov 23, 8:11 am, "Le Minh" <hanami...@hotmail.comwrote:
I receive this message:
"System.InvalidOperationException: Cross-thread operation not valid: Control
[your_control_name_here] accessed from a thread other than the thread it was
created on"
...
this is a exception. Can fix it?