PreTicketBindingSource.CancelEdit()?
Dec 9, 2008I run this, but my row of data is still being deleted.
PreTicketBindingSource.CancelEdit()
I run this, but my row of data is still being deleted.
PreTicketBindingSource.CancelEdit()
I think I started out with a misunderstanding of what happens with addnew() and canceledit().
I have a strongly typed datasource in memory.
I call bindingsource.AddNew()
Later I find that the record the user was trying to add already exists, so
bindingsource.CancelEdit()
I have not set any properties other than datasource on the bindingsource.
My assumption was that the CancelEdit() would rollback the blank row added by the AddNew(), but I'm getting some odd errors which lead me to believe this is not true.
Could someone verify that CancelEdit() leaves the new row?
I have a problem with bound controls and a bindingsource. I'm using vb 2008 and .net 2.0.I have a few text boxes bound to columns in the binding source.The backend is a Access database.
I'm using a bindingnavigator to add a new record.The additem event works fine.If the user clicks an icon to cancel edit, the code executes bindingsource.canceledit. This seems to work fine. The row count on the navigator returns to the correct number before the addnew event occurred. However, the bindingsource seems to have an empty record in it. As the bindingsource navigates, it eventually gets to the empty record depending on where it's position was when the addnew event fired.
The error received is an invalidcastexception. This error occurs because the record is repostionedand each time this occurs the code performs calculations using values from the bound controls.But when it navigates to the empty record, the values in the bound controls are null.Is there other code besides canceledit to remove the empty record?
Below is my revert subroutine:
Private Sub BindingNavigatorRevertItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BindingNavigatorRevertItem.Click
Me.GpheaderBindingSource.CancelEdit()
[Cdoe]....
My problem is Me.gpdetailbindingsource.canceledit() cancels only the current row being edited. I want all rows of my detail be reverted.
I have work with BindingSource in VB NET 2008
--
dim bsA as new bindingSource
BsA = DB
DataGridView.dataSource = bsA
[code]....
but data has changed this is correct ?I don't wont change this data what I have to do ?