|
-
Oct 17th, 2010, 12:58 PM
#1
update bindingsource
I have a dataset (dS), adapter(aD) and bindingsource(bS) I am using in a form. The datasource for bS is dS, and I am filling the adapter in the form's Load event with a table (tbl) from the dataset.
On the form I have a listbox and a textbox with the following properties set
ListBox.DataSource = bS
ListBox.DisplayMember = <coloumn 1 of tbl>
The textbox.text property is bound to <column 2 of tbl>
When I change the selected item of the listbox, the text in the textbox changes to the appropriate data from the dataset, so I know that part of what I am doing works.
When I change the text in the textbox however, the database is not updating, and I assume I am missing something small.
my code....
vb Code:
Public Class RecipeTypesForm
Private Sub RecipeTypesForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.RecipeTypesTableTableAdapter.Fill(Me.BrewBaseDataSet.RecipeTypesTable)
End Sub
Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged
Dim i As Integer = ListBox1.SelectedIndex
If i > -1 Then
Me.RecipeTypesTableBindingSource.Position = i
End If
End Sub
Private Sub OKButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OKButton.Click
Me.RecipeTypesTableTableAdapter.Update(Me.BrewBaseDataSet.RecipeTypesTable)
Me.Close()
End Sub
End Class
I am guessing I am not updating something correctly to finalize the change in the database when I close the form. Can any one see what I am not doing right?
thanks
kevin
Last edited by kebo; Oct 25th, 2010 at 11:49 AM.
Process control doesn't give you good quality, it gives you consistent quality.
Good quality comes from consistently doing the right things.
Vague general questions have vague general answers. A $100 donation is required for me to help you if you PM me asking for help. Instructions for donating to one of our local charities will be provided.
______________________________ Last edited by kebo : Now. Reason: superfluous typo's
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|