BindingSource 元件

將資料來源封裝以便繫結到控制項。

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

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

本節中

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

如何:將 Windows Forms 控制項綁定到 DBNull 資料庫值
示範如何處理來自資料來源中的 DBNull 值,使用 BindingSource 元件。

如何使用 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 中將控制項繫結至資料