MessageBox不会显示。
Private Sub MainForm_KeyPress(sender As Object, e As KeyPressEventArgs) Handles Me.KeyPress
MessageBox.Show(e.KeyChar.ToString)
End Sub
答案 0 :(得分:1)
将表单的KeyPreview属性设置为true
答案 1 :(得分:1)
将Me.KeyPress
更改为MyBase.KeyPress
...这将有效
Private Sub MainForm_KeyPress(sender As Object, e As KeyPressEventArgs) Handles MyBase.KeyPress
MessageBox.Show(e.KeyChar.ToString)
End Sub