Public Class Form1
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.KeyCode = Keys.Enter Then
MsgBox("enter key pressd ")
End If
End Sub
End Class
หรือ
Code (VB.NET)
Protected Overrides Function ProcessCmdKey(ByRef msg As System.Windows.Forms.Message, ByVal keyData As System.Windows.Forms.Keys) As Boolean
If msg.WParam.ToInt32() = CInt(Keys.Enter) Then
SendKeys.Send("{Tab}")
Return True
End If
Return MyBase.ProcessCmdKey(msg, keyData)
End Function
ลองดูครับ
Date :
2013-01-13 20:01:17
By :
mr.win
No. 2
Guest
ลองใช้ even keypress อ่ะ
If e.KeyCode = Keys.Enter Then
ิbtn_ok.performclick()
End If