not able to trap Enter key (keypress or keydown) in vb.net datagrid

  • Thread starter Thread starter Vinodh
  • Start date Start date
V

Vinodh

In vb.net, I am not able to trap the enter key neither in
keypress nor in keydown event
 
Override the method ProcessKeyPreview in your DataGrid.



protected override bool ProcessKeyPreview(ref
System.Windows.Forms.Message m)

{

Keys keyCode = (Keys)(int)m.WParam & Keys.KeyCode;

if((m.Msg == WM_KEYDOWN || m.Msg == WM_KEYUP)

&& keyCode == Keys.Enter )

//Do Stuff

return false;

return true;

}


http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp#q791q
 

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

Similar Threads


Back
Top