Datagrid

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.
 
C

ClayB [Syncfusion]

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
 
H

Herfried K. Wagner [MVP]

* "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.
 
S

Suresh Parmar

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....
 

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