How is the best way to test for the NUL
returned by a key stroke event when the Enter key is struck?
When I enter some text in a list box control, and then type an Enter the Key_Pressed
event fires and gives me oEvent
. Contained in oEvent is KeyChar
reporting the key that was typed, and in this case it’s set to NUL. (As reported by MRI).
But for some reason the Basic IsNull()
(documentation is here) function (not the SQL IsNull() function) returns False rather than True as expected:
If( IsNull(oEvent.KeyChar) ) Then ...code to execute if CR found
As a workaround I’ve found this works, but it’s awkward and less obvious:
If oEvent.KeyChar Then
Else ...code to execute if CR found
End If
Is the NUL returned by KeyChar not the same as the Null tested for in the basic IsNull function?
BTW, every keystroke fires the Key_Pressed
event, so I’m just looking for when Enter is hit.
Also for some reason MRI calls this “NUL
”, not Null.