You are not logged in.
This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.
Pages: 1
Topic closed
Hello Jing,
Is there check if the esc key is pressed in aftercell event? since i am handling the data.. when i press the esc key it takes and erase the data and i want to cancel it.
Shane
Offline
When the EndReason property of event argument is Cancel that means user pressed Esc key, but what do you mean that 'cancel it'? the Edit operation is finished, you can't cancel anything.
Last edited by Jingwood (2016-04-12 08:15:35)
Offline
Hello Jing,
I want to managed the Esc key event.. In the code there if the data is nothing or not a double it, just sets the data to nothing.. and finishes normally. I did have set to cancel, but changed it because when pressed backspace and enter it didnt delete it, not when does if delete and press esc it deletes it. what i want to do is put a condition to check if the esc was pressed and it would do normalfinish and not set the data to nothing.
Private Sub AfterCellEditIsNumeric(sender As Object, e As CellAfterEditEventArgs)
Dim val As Double = 0
If e.NewData Is Nothing OrElse Not Double.TryParse(e.NewData.ToString(), val) Then
e.NewData = Nothing
e.EndReason = EndEditReason.NormalFinish
Else
e.NewData = val
End If
End Sub
Offline
As your code
e.EndReason = EndEditReason.NormalFinish
it should work.
Offline
Hello Jing,
It works, but when use this way it removes the e.newdata.. when esc is pressed, i dont want to do that.. i want be able to manage it. like in keypress event.
if i have.. 123 in the cell and press backspace it erase it, when press esc does not revert to the 123 but sets it to nothing.
Shane
If use EndEditReason.NormalFinish the enter button works, if use EndEditReason.Cancel the esc works, so i dont put anything in it, works right
Private Sub AfterCellEditIsNumeric(sender As Object, e As CellAfterEditEventArgs)
Dim val As Double = 0
If e.NewData Is Nothing Then
e.NewData = Nothing
e.EndReason = EndEditReason.Cancel
ElseIf e.NewData Is String.Empty Then
ElseIf Not Double.TryParse(e.NewData.ToString(), val) Then
e.NewData = Nothing
e.EndReason = EndEditReason.Cancel
Else
e.NewData = val
End If
End Sub
Last edited by asparatu (2016-04-12 08:48:31)
Offline
Hi Shane, is this problem get solved? I can't see from you reply.
Last edited by Jingwood (2016-04-12 12:20:57)
Offline
Hello Jing,
No... sorry.. I got to work by just work right by not handling the endedit on the newdata string
Shane
Offline
What's your problem now?
Offline
Hello Jing,
there is not problem now.. i was just telling you.. I was able to get it working correctly without trying to handling the endreason, when the newdata is string.empty. sorry,, still didnt explain clearly enough of how i get to work right.
Shane
Offline
Glad to hear that!
Offline
Pages: 1
Topic closed