C
chris81
hello
can i make to captur the key down event on cell's datagridview??
thx
can i make to captur the key down event on cell's datagridview??
thx
chris81 said:hello
can i make to captur the key down event on cell's datagridview??
thx
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.
Le 01/11/2006, (e-mail address removed) a supposé :
have you got an example ?
thx
chris81 said:Le 01/11/2006, (e-mail address removed) a supposé :
have you got an example ?
thx
In your EditingControlShowing event, do something like this:
dgv.EditingControl.KeyDown += CellKeyDown;
Then define your event handler (CellKeyDown) for the KeyDown event.
chris81 said:James Daughtry a formulé la demande :
one complete example please because i don't understand....
thx
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 += 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