没有定义,我发现了错误调度员
'socketServer.Form1' does not contain a definition for 'Dispatcher' and no extension method 'Dispatcher' accepting a first argument of type 'socketServer.Form1' could be found
从
private void tbAux_SelectionChanged(object sender, EventArgs e)
{
this.Dispatcher.BeginInvoke(DispatcherPriority.Normal, (ThreadStart)delegate()
{
textBox.Text = tbAux.Text;
}
);
}
按照documentation,该Dispatcher
类是命名空间System.Windows.Threading
,我使用的是哪一部分。
我是否缺少另一个参考?
万一它是相关的,我在使用服务器/客户端套接字接收到“跨线程操作无效”的错误后添加了这个。
我想你想抛弃this.Dispatcher的'this.'部分,但我不积极。 – 2013-04-23 14:35:17
@ChrisSinclair试过; “对象引用是必需的” – Kermit 2013-04-23 14:36:04
这是WPF还是WinForms? – 2013-04-23 14:36:22