Hai...
How to Usercontrols with Shortcut Keys[F1,F2,F3,CTRL+O]...
I am creating one windows apllication..
the apllication contain many form..
in one form i am used one usercontrol(parent control)..
the many form used in that inherited usercontrol(child control)..
in my form i want to use shorcut keys
in usercontrol form does not have keypreview property..
so i am use the shortcut function keys
i have add,edit,delete,and search for various button in my usercontrol form
i want to put the shorcut key to each every buttons
this is my code..this nopt worked..
Private Sub frmTemplate_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
Try
If (e.KeyCode = Keys.F1) And mblnAddEnable = True Then
btnAdd_Click(sender, e)
ElseIf (e.KeyCode = Keys.F2) And mblnEditEnable = True Then
btnEdit_Click(sender, e)
ElseIf e.KeyCode = Keys.F3 And mblnDelEnable = True Then
btnDelete_Click(sender, e)
ElseIf e.KeyCode = Keys.F7 Then
btnCancel_Click(sender, e)
ElseIf e.KeyCode = Keys.F6 And mblnAdd = False And mblnEdit = False Then
btnFilter_Click(sender, e)
End If
If e.KeyCode = Keys.Enter Then
SendKeys.Send("{Tab}")
End If
Catch ex As Exception
msgbox(ex.Message.ToString())
End Try
End Sub
I am not have the keypreview property in desinging mode..
please help me..
how to use the shortcut keys
please reply me..........