xiamx
xiamx

Reputation: 7020

Convert a string, char type to System.Windows.Forms.Keys

I'm trying to get a char converted to System.windows.Form.Keys type or a string to a Keys array. Does anyone know how to do it in a simple way?

Upvotes: 1

Views: 3317

Answers (1)

Tim Robinson
Tim Robinson

Reputation: 54714

The Keys codes for the numbers and uppercase letters match the corresponding ASCII codes. Assuming you're dealing with ASCII, you can do:

Keys key = (Keys) (byte) char.ToUpper(c);

Upvotes: 4

Related Questions