Share via


.NET Samples - Windows Forms: Data Binding

This section includes the following samples:

Grid binding Sample

MasterDetails Sample

Grid binding to a WebService Sample

Simple Data binding Sample

ComboBox binding Sample

Customer Details Form Sample

Grid binding Sample

This sample demonstrates the methods used to bind a DataSet to a Windows Forms Grid control.

Namespaces used in this sample:

System; System.Drawing; System.Windows.Forms; System.ComponentModel; System.Data; System.Data.SqlClient

Classes used in this sample:

Form; Style; DataSet; Cursor; SqlDataAdapter; Table; DataAdapter; TableStyle; Component; Button; DataGrid; Control; SqlConnection; StatusBar; Container; Application; DataGridTableStyle; EventHandler; EventArgs; Thread; SystemColors; Cursors

MasterDetails Sample

This sample demonstrates populating two separate DataGrid controls from the same DataSet. A relationship is set up between the two DataGrid controls such that when a customer is selected in the first DataGrid, all that customer's orders are shown in the second DataGrid.

Namespaces used in this sample:

System; System.Drawing; System.Windows.Forms; System.Data; System.ComponentModel; System.Collections; System.ComponentModel.Design; System.Web; System.Web.Services; System.Diagnostics; System.Web.Services.Protocols; System.IO; System.Data.OleDb; System.Data.SqlClient; Microsoft.Win32

Classes used in this sample:

Type; DataColumn; SqlParameter; Region; DBNull; Exception; DataSet; Table; Form; Style; DataRow; StrongTypingException; InvalidCastException; Convert; Cursor; DataTable; EventHandler; EventArgs; SqlCommand; TableStyle; Component; DataRowChangeEventArgs; DataAdapter; SqlDataAdapter; Service; SystemColors; Message; MessageBox; DataGrid; SqlConnection; Button; DataRowBuilder; Object; WebService; Icon; Control; DataGridTableStyle; Container; Array; DataRelation; DesignerSerializationVisibilityAttribute; Cursors; SqlRowUpdatedEventHandler; StatusBar; Constraint; Attribute; Application; ForeignKeyConstraint; String; RowUpdatedEventArgs; Thread; BindingContext; Context; SqlTransaction; SqlRowUpdatedEventArgs; Binding

Grid binding to a WebService Sample

This sample demonstrates retrieving a DataSet from a WebService. This DataSet is then bound to a Grid control.

Namespaces used in this sample:

System; System.Drawing; System.Windows.Forms; System.Data; System.ComponentModel; System.Net; System.Web; System.IO; System.Web.Services; System.Data.OleDb; System.Data.SqlClient

Classes used in this sample:

DataSet; Form; Style; Service; WebService; Cursor; Binding; Table; Component; TableStyle; Control; SqlDataAdapter; DataAdapter; DataGrid; Button; Container; SqlConnection; StatusBar; EventArgs; EventHandler; Thread; SystemColors; Application; Cursors; DataGridTableStyle

Simple Data binding Sample

This sample demonstrates data binding a dataset to Windows Forms controls. In this sample, you bind to Text controls and make use of a custom coded panel to navigate the dataset.

Namespaces used in this sample:

System; System.Windows.Forms; System.Drawing; System.ComponentModel; System.Collections; System.Data; System.Data.OleDb; System.IO

Classes used in this sample:

Form; Style; Binding; TextBox; Component; Control; Label; BindingContext; Context; Button; EventArgs; EventHandler; DataBinding; String; Site; Type; Convert; Panel; StringWriter; Message; Container; ConvertEventHandler; ConvertEventArgs; SystemInformation; Thread; Application; Exception; CollectionBase; Icon; MessageBox

ComboBox binding Sample

This sample demonstrates the methods used to bind a DataSet to a Windows Forms ComboBox control. The same techniques applied here can be used to bind any DataSet to any other List control.

Namespaces used in this sample:

System; System.Windows.Forms; System.Drawing; System.ComponentModel; System.Data; System.Data.SqlClient

Classes used in this sample:

Form; Style; DataSet; Binding; Label; TextBox; Control; BindingContext; Context; Button; ComboBox; DataBinding; EventArgs; EventHandler; Component; Panel; SqlConnection; SqlDataAdapter; Container; DataAdapter; Region; Thread; Application; Pen

Customer Details Form Sample

This sample demonstrates using a disconnected DataSet on the client to supply updates through a WebService to a remote computer containing the actual database.

Namespaces used in this sample:

System; System.Windows.Forms; System.Drawing; System.Data; System.ComponentModel; System.Web.Services; System.Web; System.ComponentModel.Design; System.Collections; System.IO; System.Data.SqlClient; System.Data.OleDb; Microsoft.Win32

Classes used in this sample:

Form; DataSet; Style; Control; DataColumn; Type; Button; SqlParameter; Binding; Region; Exception; DataRow; DBNull; EventHandler; EventArgs; BindingContext; Label; Context; TextBox; Cursor; Service; Message; Table; MessageBox; WebService; Convert; Component; StrongTypingException; DataBinding; InvalidCastException; DataTable; SqlCommand; String; Icon; SqlConnection; DataRowChangeEventArgs; DataAdapter; SqlDataAdapter; Panel; Container; StatusBar; ComboBox; DataRowBuilder; Object; DataColumnChangeEventHandler; Cursors; ErrorProvider; DataRowView; StringWriter; SqlTransaction; DesignerSerializationVisibilityAttribute; CancelEventArgs; ContainerControl; SqlRowUpdatedEventArgs; CancelEventHandler; Array; RowUpdatedEventArgs; Thread; SqlRowUpdatedEventHandler; Pen; DataColumnChangeEventArgs; Application; SystemColors; Attribute