沒有定義,我發現了錯誤調度員
'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