Sunday, May 1, 2011

How to use Function Keys in VB.NET Windows Application





Capture Function Keys in VB.NET Windows Application

The following snippet might help you in capturing the Function Keys (F1 to F12) in a VB.NET application

Private Sub frmWinSamAppMain_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        ' -- Sample Code for http://DotNetDud.BlogSpot.com
        Select Case e.KeyCode
            Case Keys.F1
                MessageBox.Show("Help is on the way")
            Case Keys.F5
                RefreshMethod()
            Case Keys.F9
                MessageBox.Show("You have pressed F9")
        End Select
    End Sub

No comments:

Post a Comment