Hello,
I work in VS2005 in C#. I have a problem with my custom DataGridView and
keyboard input. I am trying to catch user input and search through current
column. Everything works fine with searching.
The problem is when I press one of non-english letters or number from
numeric keyboard I do not get character that I pressed.
For example: I press key with code 0x010D but catch it as 0x00BA.
One good example:
when I press 'e' or 'E' (Shift+e) I get inputChat = 'E', msg.WParam
= 0x45, msg.LParam = 0x120001
This is the method where I do that:
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
char inputChar = (char)((ushort)msg.WParam.ToInt32());
// msg.WParam is 0x00BA but it should be 0x010D
// msg.LParam is 0x270001
...
}
Here are the questions:
1. Is there a way to extract the correct code for the pressed key from msg
parameter and its properties?
2. Is there a better place (method) to catch a keyboard input?
I would appreciate any suggestion,
Vlado
P.S. When I catch keyboard input in one of my other custom controls I use
ProcessKeyPreview and everything works fine, but ProcessKeyPreview is not
good in DataGridView.