Joey Morani
Joey Morani

Reputation: 26611

How to convert javascript keycode to proper keycode?

Is there a way I can convert a javascript keycode into one that is used by C#?

For example 87 is the character 'w' in javascript, but in C# it's 57. And 77 is 'm' whereas it's 4D in C#. Is there a simple way to convert them? Thanks.

Upvotes: 1

Views: 672

Answers (1)

Ry-
Ry-

Reputation: 225273

The issue isn't that they're different; your C# ones are just in hexadecimal.

8710 = 5716
7710 = 4D16

Just treat them as ints, not as strings, and you'll be fine.

Upvotes: 7

Related Questions