Shortcut keys

Moishe

Member
Joined
May 30, 2003
Messages
24
Hi, I want to make my datagrid column cells to accept short cut keys defined by myself.
I created a textbox control and I want to press F5 when the cell is selected my groupbox will be visible on the form.

Private Sub dbrDay_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
If dbrDay.CurrentCell.ColumnNumber = 3 Then And e.KeyCode = Keys.F5 Then
e.Handled = True
grpVendor.Visible = True
Else
grpVendor.Visible = False
e.Handled = False
End If
End Sub
This doesnt work!
Thanks for your help
 
The short key works when Im on the form but it should only work when the cell in the datagrid is selected.
Thanks for your help
 
You are checking for the key press in the Forms KeyDown event,right? (im asking becuase the name of the sub doesnt tell much :) and you could be inherting the control). If yes and you have controls on your form, form will not catch the keydown event without KeyPreview.
 
Back
Top