2010-12-20 68 views
1

我如何刷新綁定我的意思是運行Property獲取手動綁定到文本的字段:/我找不到解決方案。我的文本框綁定到bindingSource。我想手動刷新此bindingSource如何刷新textBox中的綁定?

+0

它是WPF還是Windows窗體? – 2010-12-20 17:57:14

+0

@ alpha-mouse:bindingSource是System.Windows.Forms中的一個類,在WPF中使用DataContext屬性來處理數據源。 – sv88erik 2010-12-20 18:02:00

回答

2
bindingSource.ResetCurrentItem(); 

導致綁定到BindingSource的控件重新讀取當前選定的項目並刷新其顯示的值。


bindingSource.ResetBindings(); 

使綁定到BindingSource重新讀取列表中的所有項目,並刷新自己的顯示值的控制。