在TextBox加入KeyPress的事件,然後判斷輸入的字元
在TextBox加入KeyPress的事件,然後判斷輸入的字元
Private Sub TextBox2_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox2.KeyPress
If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Return) Then
MsgBox("輸入的值是" & TextBox2.Text)
End If
End Sub