线程间操作无效: 从不是创建控件“lstContent”的线程访问它 请指教 急

fgd 2006-01-04 10:37:33
未处理 System.InvalidOperationException
Message="线程间操作无效: 从不是创建控件“lstContent”的线程访问它。"
Source="System.Windows.Forms"
StackTrace:
在 System.Windows.Forms.Control.get_Handle()
在 System.Windows.Forms.TextBoxBase.GetSelectionStartAndLength(Int32& start, Int32& length)
在 System.Windows.Forms.TextBoxBase.AppendText(String text)
在 ChatClient.Form1.ServerResponse() 位置 C:\Documents and Settings\Administrator\桌面\c\ChatServer\ChatClient\Form1.cs:行号 510
在 System.Threading.ThreadHelper.ThreadStart_Context(Object state)
在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
在 System.Threading.ThreadHelper.ThreadStart()
...全文
136 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
胖河马 2006-01-04
  • 打赏
  • 举报
回复
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnforms/html/winforms06112002.asp

"There are four methods on a control that are safe to call from any thread: Invoke, BeginInvoke, EndInvoke, and CreateGraphics. For all other method calls, you should use one of the invoke methods to marshal the call to the control's thread."

111,125

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Creator Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧