I have a combo box that has been filled with a static table from the database, what I would like to do is allow the user to edit the value in the combobox, (i.e. add something that isn't already in the list) and have that value saved to the table.
When the application loads or a new query is performed, it binds the combobox to the dataset field holding the individual item the user selected for that record:
I also set the list for the user to select from
Now if the artist isn't in the default list, the user can add their own. What I would like to do is put that new item that didn't previously exist into the artists table.
Should I create a new dataset and add the new value to it and update the table, or is there a way I can automatically update the datasource when the combo box list changes?
When the application loads or a new query is performed, it binds the combobox to the dataset field holding the individual item the user selected for that record:
VB.NET:
With cbArtist
.DataBindings.Clear()
.DataBindings.Add(New Binding("text", bindData, "Artist"))
End With
I also set the list for the user to select from
VB.NET:
Try
Dim ds As DataSet = GetStaticData("Artists" ,"ID")
With .cbArtist
.DataSource = ds.Tables("Artists")
.DisplayMember = "Artist"
.SelectedIndex = 0
End With
Catch ex As Exception
MsgBox("Cannot load default artists list", MsgBoxStyle.Information)
End Try
Now if the artist isn't in the default list, the user can add their own. What I would like to do is put that new item that didn't previously exist into the artists table.
Should I create a new dataset and add the new value to it and update the table, or is there a way I can automatically update the datasource when the combo box list changes?