R
Roshawn
Hi,
I am trying to cancel the deletion of a datarow. When the user presses the
Delete button, a messagebox displays asking the user if they really want to
delete the current row. If "Yes", then the delete occurs; if "No", then the
current row remains in the table and is not marked for deletion.
My problem is that if the user presses the "No" button on the messagebox the
row is still removed from the table (marked for deletion). How can I stop
that from happening using the above code description?
Here's my code:
******************************
With Me.BindingContext(dvCustomers) ' references a dataview object
Select Case CType(sender, Button).Name
'other case statements are omitted here; they work fine
Case "btnDelete"
MsgBox("Are you sure you want to delete the current row?", &
_
MsgBoxStyle.YesNo, "Delete Row")
If MsgBoxResult.Yes Then
.RemoveAt(.Position)
UpdatePosition() 'utility method
End If
If MsgBoxResult.No Then
.Position = .Position 'problem occurs here - need
help
End If
End Select
******************************
Thanks,
Roshawn
I am trying to cancel the deletion of a datarow. When the user presses the
Delete button, a messagebox displays asking the user if they really want to
delete the current row. If "Yes", then the delete occurs; if "No", then the
current row remains in the table and is not marked for deletion.
My problem is that if the user presses the "No" button on the messagebox the
row is still removed from the table (marked for deletion). How can I stop
that from happening using the above code description?
Here's my code:
******************************
With Me.BindingContext(dvCustomers) ' references a dataview object
Select Case CType(sender, Button).Name
'other case statements are omitted here; they work fine
Case "btnDelete"
MsgBox("Are you sure you want to delete the current row?", &
_
MsgBoxStyle.YesNo, "Delete Row")
If MsgBoxResult.Yes Then
.RemoveAt(.Position)
UpdatePosition() 'utility method
End If
If MsgBoxResult.No Then
.Position = .Position 'problem occurs here - need
help
End If
End Select
******************************
Thanks,
Roshawn