I am working with a scanner who is sending me a Barcode like this: "¬00111111111112222222" as pressed Keys like an USB Keyboard. What I have to do is to set the Focus on a TextBox whenever I get the prefix "¬".
The Problem right now is that inside my KeyDown Event the KeyEventArgs is "System" not the character from my prefix. Is there a way to compare this sign to set the Focus?
The Code I tried is:
private void KeyDownEvent(object sender, KeyEventArgs e)
{
if (Convert.ToString(e.Key) == "¬")
{
myTextBox.Focus();
}
}
Update: I tried e.SystemKey right now and at this point, I get LeftAlt as Event argument. So maybe the AISCII-code is converted to this SystemKey LeftAlt?
Update: I logged all the keys I get when I scan a Barcode and I noticed that I do not get the ASCII-Code itself as I thought. What I get is the Key Combination to make this Symbol like ”Alt+NumPad0+NumPad7+NumPad2” so now I only have to match them with the ASCII-Code from the "¬" Symbol and then it have to work. Thanks for all the help..