Visual Basic: Bind a text field to a database table field

Platform:Visual Basic
Task:Bind a text field to a database table field
Discussion:
When binding non-grid controls. You'll have to add a binding object into its databindings property. Here's an example:
Example:
Binding myBind = new Binding("Text", dt, "ColumnName");
textBox1.DataBindings.Add(myBind);

'Where dt is a datasource (DataTable, DataSet,...) and "ColumnName" is the fields name and the "Text" is the property of the control to bind the field to...
Back to Index