We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Regd--- # Key

Hi There, I am using gridDataBoundGrid.There is a virtual method with the following signature "ProcessKeyMessage(ref Message m)".I have overrided it, in that method i am writing the following statement. Keys keyCode = (Keys)((int)m.WParam) & Keys.KeyCode; The KeyCode returns me "End" when we press "Shift + 3" key which is supposed to send me "#".Kindly solve the problem as early as possible. Thanks in advance, Thanks & Regards, Manohar B.

3 Replies

AD Administrator Syncfusion Team March 16, 2006 12:20 PM UTC

Hi Manohar, Try the below code snippet to see if that helps. Keys keyCode = (Keys)((int)m.WParam) & Keys.KeyCode; if (m.Msg == 0x102/*WM_CHAR*/ || m.Msg == 0x106/*WM_SYSCHAR*/) Console.WriteLine(((Char)m.WParam).ToString()); Regards, Calvin.


AD Administrator Syncfusion Team March 17, 2006 05:06 AM UTC

Hi Clavin, Happy to see the working code,but can you just give some explanation on the code that you have give.What i noticed is it is firing for all characters(also special) but not for stokes like "Home","End","Right Arrow" etc,.Can you just tell how does the latest code snippet give by you differs from the previous which i have given you. Thanks in advance, Thanks & Regards, Manohar B. >Hi Manohar, > >Try the below code snippet to see if that helps. > >Keys keyCode = (Keys)((int)m.WParam) & Keys.KeyCode; > > if (m.Msg == 0x102/*WM_CHAR*/ || m.Msg == 0x106/*WM_SYSCHAR*/) > Console.WriteLine(((Char)m.WParam).ToString()); > >Regards, >Calvin.


AD Administrator Syncfusion Team March 17, 2006 06:53 AM UTC

Hi Manohar, The Keys specifies only the key codes and modifiers and not the key char. To get the key char the WParam must be cast to Char. Below is code snippet which checks for the Shift Modifier key and then get the char value else just the keyCode. Let us know if this serves your need. if(Control.ModifierKeys == Keys.Shift && m.Msg == 0x102/*WM_CHAR*/ ) Console.WriteLine(((Char)m.WParam).ToString()); else Console.WriteLine(((Keys)((int)m.WParam)).ToString()); Regards, Calvin.

Loader.
Live Chat Icon For mobile
Up arrow icon