winforms, DataGrid, Key press events... KeyUp, KeyPress" are ignored

S

Serdge Kooleman

How to get "Key press" event when i'm working with DataGrid (winforms).

Seems to me that standard events "KeyUp, KeyPress" are ignored :-(

Thank you
 
J

jeremiah johnson

Serdge said:
How to get "Key press" event when i'm working with DataGrid (winforms).

Seems to me that standard events "KeyUp, KeyPress" are ignored :-(

Thank you

they work fine for me.

i created a form with two textboxes, textBox1 and textBox2.

private void textBox1_KeyUp(object sender, KeyEventArgs e) {
textBox2.Text = "keyup";
}

private void textBox1_KeyDown(object sender, KeyEventArgs e) {
textBox2.Text = "keydown";
}

i attached those methods to the KeyUp and KeyDown events and it all
worked great.
 
R

Roman H.

U¿ytkownik "Serdge Kooleman said:
How to get "Key press" event when i'm working with DataGrid (winforms).

Seems to me that standard events "KeyUp, KeyPress" are ignored :-(

Thank you

Hi,

Set property on the form: KeyPreview = True

Roman Halas
 
S

Serdge Kooleman

Thank you for argumenting... but... i use DataGrid, not textBox. for texBox
all is fine, thats true.
So "DataGrid" for Windows.
source code of this small test application is here:

http://examples.20m.com/CustomDataGrid.zip

picture of this form is here:
http://examples.20m.com/CustomGridForm.GIF
Set property on the form: KeyPreview = True
i do not see this property :-(

private void dataGrid1_KeyUp(object sender,
System.Windows.Forms.KeyEventArgs e)
{ //not working !!
textBox1.Text = "KeyCode="+ e.KeyCode.ToString() + " ; KeyValue=" +
e.KeyValue.ToString();
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top