VB.Net KeyChar

VBNET Using Key Char

VBnet Key Char

In This VB.Net Tutorial  We Will See How To Use KeyChar On KeyPress To Check Which Key Is Pressed Like ENTER or SPACE In Visual Basic.Net Programming Language And Visual Studio Editor.


Project Source Code:

Public Class Form_key_char


    Private Sub Form_key_char_KeyPress(sender As Object, e As KeyPressEventArgs) Handles MyBase.KeyPress

        Dim ch As String
        ch = e.KeyChar

        Label1.Text = ch

        Select Case ch

            Case Convert.ToChar(Keys.Enter)
                Label1.Text = "Enter"

            Case Convert.ToChar(Keys.Space)
                Label1.Text = "Space"

        End Select

    End Sub
End Class
      
///////////////OUTPUT:
vbnet enter key press

vbnet spacebar key press




Share this

Related Posts

Previous
Next Post »