G
Guest
I was following the examples in the documentation but I think I am missing
something. When I detect an invalid input I set e.Cancel to True. The problem
is that in CellEndEdit I cannot cancel the error or clear the error text. I
have some lines that look like:
Private Sub dgvOrderItems_EditingControlShowing(ByVal sender As
Object, ByVal e As DataGridViewEditingControlShowingEventArgs) Handles
dgvOrderItems.EditingControlShowing
e.CellStyle.BackColor = Color.Aquamarine
_editingControl = DirectCast(e.Control,
DataGridViewTextBoxEditingControl)
AddHandler _editingControl.TextChanged, AddressOf
dgvOrderItems_TextChanged
End Sub
Followed by the CellEndEdit handler:
Private Sub dgvOrderItems_CellEndEdit(ByVal sender As Object, ByVal
e As System.Windows.Forms.DataGridViewCellEventArgs) Handles
dgvOrderItems.CellEndEdit
RemoveHandler _editingControl.TextChanged, AddressOf
dgvOrderItems_TextChanged
' Clear the error text
dgvOrderItems.Rows(e.RowIndex).ErrorText = String.Empty
The problem is that the text in the edit control is still the invalid input
that the user entered. If I click <ESC> I get into this handler but the text
in the edit control is still the invalid input. I would like to revert back
to what was in the cell before editing began. Any ideas? Maybe I need a
tutorial on the flow that happens after e.Cancel is set. Which events are
fired? What can I expect on the text?
Thank you.
Kevin
something. When I detect an invalid input I set e.Cancel to True. The problem
is that in CellEndEdit I cannot cancel the error or clear the error text. I
have some lines that look like:
Private Sub dgvOrderItems_EditingControlShowing(ByVal sender As
Object, ByVal e As DataGridViewEditingControlShowingEventArgs) Handles
dgvOrderItems.EditingControlShowing
e.CellStyle.BackColor = Color.Aquamarine
_editingControl = DirectCast(e.Control,
DataGridViewTextBoxEditingControl)
AddHandler _editingControl.TextChanged, AddressOf
dgvOrderItems_TextChanged
End Sub
Followed by the CellEndEdit handler:
Private Sub dgvOrderItems_CellEndEdit(ByVal sender As Object, ByVal
e As System.Windows.Forms.DataGridViewCellEventArgs) Handles
dgvOrderItems.CellEndEdit
RemoveHandler _editingControl.TextChanged, AddressOf
dgvOrderItems_TextChanged
' Clear the error text
dgvOrderItems.Rows(e.RowIndex).ErrorText = String.Empty
The problem is that the text in the edit control is still the invalid input
that the user entered. If I click <ESC> I get into this handler but the text
in the edit control is still the invalid input. I would like to revert back
to what was in the cell before editing began. Any ideas? Maybe I need a
tutorial on the flow that happens after e.Cancel is set. Which events are
fired? What can I expect on the text?
Thank you.
Kevin