all groups > dotnet windows forms > october 2006 >
You're in the

dotnet windows forms

group:

Key down an datagridview


Key down an datagridview chris81
10/31/2006 5:28:42 PM
dotnet windows forms:
hello
can i make to captur the key down event on cell's datagridview??

thx

Re: Key down an datagridview mordock32 NO[at]SPAM hotmail.com
11/1/2006 10:09:13 AM
[quoted text, click to view]

I just recently had a need to do this myself. First, you can get the
editing control for that cell by handling the EditingControlShowing
event of the DataGridView. Then you can subscribe to the KeyDown event
of the editing control.
Re: Key down an datagridview chris81
11/2/2006 12:00:00 AM
Le 01/11/2006, mordock32@hotmail.com a supposé :
[quoted text, click to view]

have you got an example ?

thx

Re: Key down an datagridview chris81
11/2/2006 12:00:00 AM
Dans son message précédent, chris81 a écrit :
[quoted text, click to view]

yes i add

Private Sub dataGridView1_EditingControlShowing(ByVal sender As
Object, ByVal e As DataGridViewEditingControlShowingEventArgs) Handles
dgCompositionFormule.EditingControlShowing

e.CellStyle.BackColor = Color.Aquamarine

End Sub

but how can i captur key ??

thx

Re: Key down an datagridview James Daughtry
11/2/2006 5:28:30 AM

[quoted text, click to view]

In your EditingControlShowing event, do something like this:

dgv.EditingControl.KeyDown +=3D CellKeyDown;

Then define your event handler (CellKeyDown) for the KeyDown event.
Re: Key down an datagridview chris81
11/3/2006 12:00:00 AM
James Daughtry a formulé la demande :
[quoted text, click to view]

one complete example please because i don't understand.... :(

thx

Re: Key down an datagridview James Daughtry
11/3/2006 6:24:55 AM
[quoted text, click to view]

That was a complete example. Presumably you know how to write a KeyDown
even handler, so the only unfamiliar part is the single line I gave
you:

Private Sub dataGridView1_EditingControlShowing(ByVal sender As
Object, ByVal e As DataGridViewEditingControlShowingEventArgs) Handles
dgCompositionFormule.EditingControlShowing
dgCompositionFormule.EditingControl.KeyDown +=3D CellKeyDown
End Sub

Private Sub CellKeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs)
' Whatever you want to do when the key is down here
End Sub
Re: Key down an datagridview chris81
11/6/2006 1:25:21 PM
James Daughtry avait écrit le 03/11/2006 :
[quoted text, click to view]

thanks

AddThis Social Bookmark Button