ConsoleKey Enumeration
Imports System.Text
Module ConsoleKeyExample
Public Sub Main()
Dim input As ConsoleKeyInfo
Do
Console.WriteLine("Press a key, together with Alt, Ctrl, or Shift.")
Console.WriteLine("Press Esc to exit.")
input = Console.ReadKey(True)
Console.WriteLine(input.Key.ToString())
If (input.Modifiers And ConsoleModifiers.Alt) = ConsoleModifiers.Alt Then
Console.WriteLine(", together with " + ConsoleModifiers.Alt.ToString())
End If
If (input.Modifiers And ConsoleModifiers.Control) = ConsoleModifiers.Control Then
Console.WriteLine(ConsoleModifiers.Control.ToString)
End If
If (input.Modifiers And ConsoleModifiers.Shift) = ConsoleModifiers.Shift Then
Console.WriteLine(ConsoleModifiers.Shift.ToString)
End If
Loop While input.Key <> ConsoleKey.Escape
End Sub
End Module
Related examples in the same category