Datagrid

  • Thread starter Thread starter Suresh Parmar
  • Start date Start date
S

Suresh Parmar

I am developing a UI that will be mainly keyboard driven.
I have a datagrid that needs to return a value when the
user hits the 'Return' button.

I have tried the keypress, keydown, and keyup events at
the datagrid as well as at form level, but have not
succeeded in being able to return the value of the current
cell.

Anyone help would be greatly appricated.
 
I think you can catch the Enter key by overriding ProcessKeyPreview.

George Shepherd's Windows Forms FAQ contains an entry entitled:

How can I prevent the Enter key from moving to the next cell when the
user is actively editing the cell and presses Enter?

Check it out at:
http://www.syncfusion.com/faq/winforms/search/791.asp

=============================================
Clay Burch, [MVP]
Syncfusion, Inc.
visit http://www.syncfusion.com for .NET Essentials
 
* "Suresh Parmar said:
I am developing a UI that will be mainly keyboard driven.
I have a datagrid that needs to return a value when the
user hits the 'Return' button.

I have tried the keypress, keydown, and keyup events at
the datagrid as well as at form level, but have not
succeeded in being able to return the value of the current
cell.

You can use 'DataGrid.CurrentCell' to get a reference to the current
cell. In order to handle the enter key, you an listen in
'ProcessDialogKey' for this key.
 
Thanks a lot guys. Found the info on George Shephards
Windows forms FAQ.

I am overiding ProcessCmdKey and it seems to work a treat.

Regards.
Suresh....
 
Back
Top