kutz Posted April 5, 2005 Posted April 5, 2005 Hi all, I am having a problem with a databound combobox in that when I save the record (ie, end current edit,update the database and accept the changes) the combobox resets its value back to the first object in the list. Anyone else experienced this problem before? My code for saving goes something like this. 'MsgBox("Record Saved") 'Create a new dataset to hold the changes that have been made to the main dataset. Dim objDataSetChanges As Buckner_Intranet.dsNCR = New Buckner_Intranet.dsNCR 'Stop any current edits. Me.BindingContext(DsNCR1, "NCR").EndCurrentEdit() Me.BindingContext(Me.DsNCR1, "Responses").EndCurrentEdit() 'Get the changes that have been made to the main dataset. objDataSetChanges = CType(DsNCR1.GetChanges, Buckner_Intranet.dsNCR) 'Check to see if any changes have been made. If (Not (objDataSetChanges) Is Nothing) Then Try Me.BindingContext(Me.DsNCR1, "NCR").EndCurrentEdit() Me.BindingContext(Me.DsNCR1, "Responses").EndCurrentEdit() daNCR.Update(Me.DsNCR1, "NCR") daResponses.Update(Me.DsNCR1, "Responses") Catch eUpdate As System.Exception MsgBox(eUpdate.Message) End Try 'Commit the changes that were just merged 'This moves any rows marked as updated, inserted or changed to being marked as original values DsNCR1.AcceptChanges() End If Cheers for any help you might be able to offer. Kutz Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.