Does Chrb(31) equal Keydown binary 1E

I have a textarea with keydown and this test for NOT arrow key

If (Key <> ChrB(31) Or Key <> ChrB(30)) And 0 <> InStr(me.Text, " of ") Then

The arrow keys are entering the If statement.
So, does Chrb(31) equal Keydown binary 1E?

This expression will always be True:

(Key <> ChrB(31) Or Key <> ChrB(30))

If key is ChrB(29) –> (True Or True) –> True
If key is ChrB(30) –> (True Or False) –> True
If key is ChrB(31) –> (False Or True) –> True

You PROBABLY want this

If (Key = ChrB(31) Or Key = ChrB(30)) And  InStr(me.Text, " of ")>0 Then

I should have included the purpose for numeric detection, and I changed it for the relevant chr’s.
Sorry for being difficult, but My question is still was my code correct for stopping an arrow key?

(Key <> ChrB(31) Or Key <> ChrB(30))

[quote=352478:@Arthur Gabhart]I should have included the purpose for numeric detection, and I changed it for the relevant chr’s.
Sorry for being difficult, but My question is still was my code correct for stopping an arrow key?

(Key <> ChrB(31) Or Key <> ChrB(30)) [/quote]
No… because that statment as Eli pointed out, will ALWAY return TRUE… for ANY key

0x31 is not 0x30 … so its true
0x30 is not 0x31 … so it true
any other key is not 0x30 … so its true
any other key is not 0x31 … so its true

if this is in the KEYDOWN event

if ascb(key)=30 or ascb(key)=31 then return true
.... now do stuff for any other key ...

Thanks. I see my error now. Logic isn’t my strong point sometimes

You might want to look into some websites or tutorials on Boolean Algebra.
This is a course I took way (way) back in the mid 1970’s (yeah, I’m old :slight_smile: )
but it laid the foundation for almost everything else I have learned concerning computers.