Reputation: 25
I was trying to make a Visual Basic .NET program that shows, when a key is down, a MsgBox with the code of the key pressed: the problem is that the program read a lowercase letter (for example, 'a') as the same of the corresponding uppercase letter (for example, 'A').
This is the code in VB .NET, Framework 4.6.1:
Public Class Form1
Dim character As String
Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyDown
MsgBox(e.KeyCode, MsgBoxStyle.Information)
End Sub
End Class
How can I read a lowercase letter and the corresponding uppercase letter in two different numbers?
Upvotes: 2
Views: 2849
Reputation: 26
To illustrate Hans comment:
Private Sub TextBox1_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Dim msg As String = String.Format("You pressed: {0}", e.KeyChar.ToString)
MessageBox.Show(msg)
End Sub
Upvotes: 1