Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...