Solved this program:accessed from a thread other than the thread it was created on.
2007-08-02 16:55
661 查看
protected void myWatcher_Created(object sender, FileSystemEventArgs e)
{
string s = "ChangeType :: " + e.ChangeType.ToString() + "/nFullPath ::" + e.FullPath.ToString() + "/n/n";
AppendText(s);
}
private delegate void AppendTextHandler(string s);
private void AppendText(string s)
{
if( richTextBox1.InvokeRequired )
richTextBox1.Invoke(new AppendTextHandler(AppendText), new object[]{s});
else
richTextBox1.Text += s;
}
{
string s = "ChangeType :: " + e.ChangeType.ToString() + "/nFullPath ::" + e.FullPath.ToString() + "/n/n";
AppendText(s);
}
private delegate void AppendTextHandler(string s);
private void AppendText(string s)
{
if( richTextBox1.InvokeRequired )
richTextBox1.Invoke(new AppendTextHandler(AppendText), new object[]{s});
else
richTextBox1.Text += s;
}
相关文章推荐
- Cross-thread operation not valid: accessed from a thread other than the thread it was created on.
- 【转发】Cross-thread operation not valid: Control 'progressBar1' accessed from a thread other than the thread it was created on
- Cross-thread operation not valid: Control 'progressBar1' accessed from a thread other than the thread it was created on
- BackgroundWorker .net 2.0 里微软的多线程组件 学习 Cross-thread operation not valid: Control 'RichTextBox1' accessed from a thread other than the thread it was created on.
- Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be
- 错误:created a ThreadLocal with key of type ……but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
- Tried to obtain the web lock from a thread other than the main thread or the web thread. This may be
- android.view.ViewRootImpl$CalledFromWrongThreadException: Only the original thread that created a view hierarchy can touch its views.
- CalledFromWrongThreadException:Only the original thread that created a view hierarchy can touch its
- Assertion failed: Cancelling DisplayDialog because it was run from a thread that is not the main 。。
- 【解决】iOS开发,更新界面时崩溃,Tried to obtain the web lock from a thread other than the main thread or ……
- calledfromwrongthreadexception only the original that created a view hierarchy can touch its views
- The object or library file 'xxx.obj' was created with an older compiler than other obj
- This application is modifying the autolayout engine from a background thread after the engine was ac
- fatal error C1047: The object or library file "..."was created with an older compiler than other obj
- This application is modifying the autolayout engine from a background thread after the engine was ac
- fatal error C1189: #error : "This file was generated using the moc from 4.4.3. It
- fatal error C1189: #error : "This file was generated using the moc from 4.4.3. It
- The VM session was closed before any attempt to power it on.
- Android 解决Only the original thread that created a view hierarchy can touch its views异常