How to Usercontrols with Shortcut Keys[F1,F2,F3,CTRL+O]...

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • thirunavukarasukm
    New Member
    • May 2007
    • 21

    How to Usercontrols with Shortcut Keys[F1,F2,F3,CTRL+O]...

    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(par ent control)..

    the many form used in that inherited usercontrol(chi ld 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_Key Down(ByVal sender As Object, ByVal e As System.Windows. Forms.KeyEventA rgs) Handles MyBase.KeyDown

    Try

    If (e.KeyCode = Keys.F1) And mblnAddEnable = True Then

    btnAdd_Click(se nder, e)

    ElseIf (e.KeyCode = Keys.F2) And mblnEditEnable = True Then

    btnEdit_Click(s ender, 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.Messa ge.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..........
Working...