26-12-21, 02:04 AM
كود :
If e.KeyCode = Keys.Enter Then
MsgBox("enter key pressd ")
End Ifكود :
Public Class Form1
Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
If e.KeyChar = Convert.ToChar(13) Then
MsgBox("enter key pressd ")
End If
End Sub
End ClassHow to Detecting arrow keys in VB.Net
![[صورة مرفقة: arrowkeys.png]](http://vb.net-informations.com/gui/img/arrowkeys.png)
In order to capture keystrokes in a VB.Net Forms control, you must derive a new class that is based on the class of the control that you want, and you override the ProcessCmdKey().
كود :
Protected Overrides Function ProcessCmdKey(ByRef msg As Message, ByVal keyData As Keys) As Boolean
'handle your keys here
End Function