Windows Develop Bookmark and Share   
 index > Windows Forms General > why 'q' cann't input
 

why 'q' cann't input

hello,

I use a textbox on datagridview for input, the below

at event load

datagridview.controls.add(textbox);

textbox.Visible=false;

at eventCellEnter

rect = datagridview.GetCellDisplayRectangle(datagridview.CurrentCell.ColumnIndex, datagridview.CurrentCell.RowIndex, false);
textbox.Left = rect.Left;
textbox.Top = rect.Top;
textbox.Width = rect.Width;
textbox.Height = rect.Height;
textbox.Text = datagridview.CurrentCell.Value.ToString();

textbox.Visible=true;

why i cann't put 'q' into textbox ?

thanks a lot.

alphais  Tuesday, January 08, 2008 11:47 AM
do you have any code in teh keypress or keydown event for the textbox.. if yes you can check there whether you are cancelling the key..

Prasant Swain  Tuesday, January 08, 2008 1:56 PM

Is the 'q' on your keyboard working?

Really though I can't think of a reason you can't put a q in a textbox, unless of course you mean you can't insert any character what so ever?

Zamial  Tuesday, January 08, 2008 11:54 AM

the keybord is well,this problem happento every user.only 'q' cann't put into textbox

alphais  Tuesday, January 08, 2008 1:08 PM
do you have any code in teh keypress or keydown event for the textbox.. if yes you can check there whether you are cancelling the key..

Prasant Swain  Tuesday, January 08, 2008 1:56 PM

thank you for your answer,

I use PreviewKeyDown.

switch (e.KeyData)
{
case Keys.Enter:

break;

default:

break;

}

I add red code, 'q' can display in textbox, but I don't know why only 'q' is have problem.
alphais  Tuesday, January 08, 2008 2:37 PM

I have the same problem. I also found that delete key doesn't work either (it is hotkey for deleting selected row/column).After spending several hours I found how to solve the problem. In the control derived from DataGridView I overrode following method

protected override bool ProcessKeyPreview(ref Message m)

{

if (MyTextBoxShown)

{

KeyEventArgs ke = new KeyEventArgs((Keys)((int)m.WParam) | ModifierKeys);

if ((ke.KeyCode == Keys.Delete) || (ke.KeyCode == Keys.Q) || ke.KeyCode == Keys.F2)

{

returnfalse;

}

else

returnbase.ProcessKeyPreview(ref m);

}

else

returnbase.ProcessKeyPreview(ref m);

}

Question to Microsoft developers: Why did call to DataGridView.ProcessKeyPreview returned true when user clicked Q key? I didn't find this to be hotkey for any action. Are there any other keys that might not work (e.g. some other key on non-Enlish keyboard)?

Tatyana Yakushev  Wednesday, July 09, 2008 9:00 PM
Thank you, Tatyana! I had this same problem with DataGridView and 'Q', and your solution works perfectly.
CSX321  Thursday, August 07, 2008 3:11 PM

You can use google to search for other answers

Custom Search

More Threads

• C#,javascript, ASP.Net - Avoid the glowing border lines in Media player
• Read .cgm image to a picturebox or convert it to bmp/wmf
• Urgent! ListViewGroup Colours
• windows media player 11
• Microsoft Web Browser control
• ArgumentException in DrawString
• Application.ExecutablePath gives strange info
• adding passwods
• How to capture image of application window
• How to populate a gridview based on the users selection from another gridview