I am currently looking for away to manage updating data using a dataset and textboxes on a windows form.
1. I'm retrieving data from a database and populating a dataset with the results (about 10 rows of data in 1 table).
2. I am then binding the dataset to a datsgridView on the form. (All is good)
3. I have a few textboxes on the form and i bind a row to the text boxes. (ill include the code below)
4. As i click on the datagridview row the contents of that row will be displyed i the textboxes. (All is good). Everyclick of the row displays new data (i am using a BindingManagerBase here to iterate through the bindings)
What i would like to happen next:
Edit one of the textboxes and when the user leaves the textbox that the changes will get saved in the dataset and reflected in the datviewGrid.
The dataset is then passed to a function to update or create a new record (Note this is NOT being done through an SQLDataAdapter)
My take on this is that i've bound the textboxes to the grid, so would this be a one way binding ds -> textbox. Do i need a binding from textbox -> ds or is this handled in the binding.
I've been mssing with bindingsources as well.
Any help would be greatly apprciated.
Dim manager As BindingManagerBase
Dim ds a new Dataset
Private Sub frm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ds = Service.GetDetails(ID)
DataGridView1.DataSource = dsTables(0)
Private Sub DataGridView1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles DataGridView1.Click
Dim RowID As Integer
RowID = DataGridView1.CurrentRow.Index
manager.Position = RowID
Catch ex As Exception
Private Sub Textbox1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles Textbox1.Leave
Private Sub BindDetails()
Dim field1 As New Binding("Text", ds, "TableName.Field1")
Dim field2 As New Binding("Text", ds, "TableName.Field2")
manager = Me.BindingContext(ds, "TableName")