BindingSource 元件

封裝資料來源以繫結至控制項。

BindingSource 元件有兩種用途。 首先,在將表單上的控制項繫結至資料時,它會提供一層間接取值。 其作法是將 BindingSource 元件繫結至您的資料來源,然後將表單上的控制項繫結至 BindingSource 元件。 與資料的所有進一步互動,包括巡覽、排序、篩選和更新,都會透過呼叫 BindingSource 元件來完成。

第二,BindingSource 元件可以做為強類型資料來源。 使用 Add 方法將類型加入 BindingSource 元件時,會建立該類型的清單。

本節內容

BindingSource 元件概觀
介紹 BindingSource 元件的一般概念,此元件可讓您將資料來源繫結至控制項。

操作說明:將 Windows Forms 控制項繫結至 DBNull 資料庫值
示範如何使用 BindingSource 元件來處理來自該資料來源的 DBNull 值。

如何:使用 Windows Forms BindingSource 元件排序和篩選 ADO.NET 資料
示範如何使用 BindingSource 元件,將排序和篩選套用至所顯示的資料。

如何:使用 Windows Forms BindingSource 繫結至 Web 服務
示範如何使用 BindingSource 元件繫結至 Web 服務。

操作說明:處理資料繫結時所發生的錯誤和例外狀況
示範如何使用 BindingSource 元件,正常處理資料繫結作業中發生的錯誤。

操作說明:將 Windows Forms 控制項繫結至型別
示範如何使用 BindingSource 元件繫結至類型。

操作說明:將 Windows Forms 控制項繫結至 Factory 物件
示範如何使用 BindingSource 元件繫結至 Factory 物件或方法。

操作說明:使用 Windows Forms BindingSource 自訂加入項目
示範如何使用 BindingSource 元件來建立新的項目,並將其加入資料來源中。

操作說明:使用 BindingSource ResetItem 方法引發變更通知
示範如何使用 BindingSource 元件,針對不支援變更通知的資料來源,引發變更通知事件。

如何:使用 BindingSource 和 INotifyPropertyChanged 介面引發變更通知
示範如何使用繼承自 INotifyPropertyChanged,具有 BindingSource 控制項的類型。

如何:使用 BindingSource 反射 Windows Forms 控制項中的資料來源更新
示範如何使用 BindingSource 元件來回應資料來源中的變更。

操作說明:使用 BindingSource 元件跨表單共用繫結資料
示範如何使用 BindingSource 將多個表單繫結至相同的資料來源。

參考

BindingSource
提供 BindingSource 元件的參考文件。

BindingNavigator
提供 BindingNavigator 控制項的參考文件。

Windows Forms 資料繫結
包含描述 Windows Form 資料繫結架構的主題連結。

另請參閱在 Visual Studio 中將控制項繫結至資料