Moishe Posted June 26, 2003 Posted June 26, 2003 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 doesn't work! Thanks for your help Quote
*Experts* mutant Posted June 26, 2003 *Experts* Posted June 26, 2003 Try setting your form's KeyPreview property to true. Quote
Moishe Posted June 26, 2003 Author Posted June 26, 2003 The short key works when I'm on the form but it should only work when the cell in the datagrid is selected. Thanks for your help Quote
*Experts* mutant Posted June 26, 2003 *Experts* Posted June 26, 2003 You are checking for the key press in the Form's 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. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.