Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to handle keypress event in datagridview cell
Message
From
03/01/2009 00:36:46
 
 
To
02/01/2009 23:38:35
Arjun Bagojikop
Dynamic Super Software
Sangli, India
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
VB 8.0
OS:
Windows XP SP2
Network:
Windows XP
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01370794
Message ID:
01370798
Views:
13
I think that you probably need a sub-class of the DataGridViewTextBoxEditingControl (or your own control that implements the IDataGridViewEditingControl) and then override the EditingControlWantsInputKey method. That should work.

I tried to do a similar thing that you've tried below, and could not get it to work either, so I'm thinking that my above suggestion may be your only option.

~~Bonnie



>hi all
>i am trying to handle keypress event but i am not getting result like after press enter key
> Private Sub dataGridView_EditingControlShowing(ByVal sender As Object, ByVal e As DataGridViewEditingControlShowingEventArgs) Handles DataGridView1.EditingControlShowing
> AddHandler e.Control.KeyDown, AddressOf Control_KeyPress
> End Sub
>
> Private Sub Control_KeyPress(ByVal sender As Object, ByVal e As KeyEventArgs)
> MsgBox(e.KeyCode)
>
>
> 'If e.KeyChar = Chr(13) Then
> ' 'If (Char.IsNumber(e.KeyChar)) Then
> ' MsgBox("OK")
>
> ' ' //your code here
> 'End If
>
> End Sub
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform