N
Nevyn Twyll
Clear DayI have a windows form.
It fetches some data that it keeps in a Dataset.
I want to bind a grid to that datasource, and have 2 textboxes on the form
that display the contents of a couple of text fields.
The only thing I can really get to happen is to have the textboxes display
the data from the first row of the dataset, but not update.
Here's a sample of my code:
// Fetch the data and name the table
DataSet ds = sqlconnection.ExecuteDataSet(...)
ds.Tables[0].TableName = "MyTable";
// Bind the datagrid
myDataGrid.DataMember = "MyTable";
myDataGrid.DataSource = ds;
// Bind the textbox?
txtMyTextBox.DataBindings.Add(new Binding("Text", ds,
"MyTable.MyTextField"));
Thanks for the help!
It fetches some data that it keeps in a Dataset.
I want to bind a grid to that datasource, and have 2 textboxes on the form
that display the contents of a couple of text fields.
The only thing I can really get to happen is to have the textboxes display
the data from the first row of the dataset, but not update.
Here's a sample of my code:
// Fetch the data and name the table
DataSet ds = sqlconnection.ExecuteDataSet(...)
ds.Tables[0].TableName = "MyTable";
// Bind the datagrid
myDataGrid.DataMember = "MyTable";
myDataGrid.DataSource = ds;
// Bind the textbox?
txtMyTextBox.DataBindings.Add(new Binding("Text", ds,
"MyTable.MyTextField"));
Thanks for the help!