Einar:
It works in normal textbox but it doesn´t work in the datagrid.column.textbox it traps any other key but not "enter" key.
>Juan,
>Does something like this work?
>
>private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
>{
> MessageBox.Show(e.KeyChar.ToString());
> if (e.KeyChar == (char) System.Windows.Forms.Keys.Enter)
> {
> MessageBox.Show("Enter");
> }
> else
> {
> MessageBox.Show("Not Enter");
> }
>}
>
>
>I tested it on a standard textbox.
>
>Einar
>
>>Yes, it catchs KeyPress event but not "Enter" key any letter from a to z is catched.
>>
>>>Juan,
>>>Does it catch the KeyPress event?
>>>
>>>Einar
>>>>Thank's Einar, the problem is that the textbox of the datagrid column doesn't catch the keyup event.
>>>>
>>>>>>I am trying to find the way to catch when user press enter key on a datagrid cell and perform a method inside the form, i am using a selector form wich contains a datagrid as that one of Les Pinter's book in which he uses a "select" button to select the record, i could catch double click event in the textbox of the column that contains the key field through an event handler which catch's double clik on that particular textbox i want to do the same pressing "enter" key.
>>>>>>I hope you 'd understood me and thank's in advance.
>>>>>
>>>>>Juan,
>>>>>There are atleast two events you can use for this: KeyUp and KeyPress.
>>>>>Here is some code where I used KeyUp (it is C# but it should be easy to translate into VB.NET)
>>>>>
>>>>>private void textBox1_KeyUp(object sender, System.Windows.Forms.KeyEventArgs e)
>>>>>{
>>>>> if (e.KeyCode == System.Windows.Forms.Keys.Enter)
>>>>> {
>>>>> MessageBox.Show("Enter button was pressed");
>>>>> }
>>>>>}
>>>>>
>>>>>
>>>>>Hope this helps.
>>>>>
>>>>>Einar