Click here to Skip to main content
12,510,981 members (59,059 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C#
Here code as follows;
for my above code how to use data grid view event handler.
private void datagridView_CellEnter(object sender, DataGridViewCellEventHandler e)
{
 if (e.KeyCode == Keys.Space)
 {
   Message Box.Show("test");
 }
} 
here i use the above code but it is not working.it shows the error.

'System.Windows.Forms.DataGridViewCellEventHandler' does not contain a definition for 'KeyCode' and no extension method 'KeyCode' accepting a first argument of type 'System.Windows.Forms.DataGridViewCellEventHandler' could be found (are you missing a using directive or an assembly reference?) .
if (e.KeyCode == Keys.Space)
 {
   Message Box.Show("test");
 }
for the above code in key code

private void datagridView_CellEnter(object sender, DataGridViewCellEventHandler e)
for the above line which datagriview event handler to be used.

please help me.

/Edit Code Block Added
Posted 6-Jan-13 19:17pm
Updated 6-Jan-13 20:31pm
Jibesh17.4K
v2

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

If you look at the DataGridViewCellEventHandlerhttp://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewcelleventhandler.aspx[^], KeyCode is absent.
Look for an alternate solution.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160929.1 | Last Updated 7 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100