14-09-19, 03:52 AM
السلام عليكم اخي الكريم
تفضل هذا الكود في حدث KeyDown هذه محموعة من المفاتيح
بنفس الطريقة ضع المفتاح الذي تريد وبدل اظهار رسالة ضع الكود الذي تريد تنفيذه
كود :
Private Sub TextBox1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
If e.Alt Then
MsgBox("Alt")
ElseIf e.KeyCode = Keys.ShiftKey Then
MsgBox("ShiftKey")
ElseIf e.KeyCode = Keys.A Then
MsgBox("A")
ElseIf e.KeyCode = Keys.Cancel Then
MsgBox("Cancel")
ElseIf e.KeyCode = Keys.ControlKey Then
MsgBox("Control")
ElseIf e.KeyCode = Keys.Enter Then
MsgBox("Enter")
ElseIf e.KeyCode = Keys.Escape Then
MsgBox("Escape")
ElseIf e.KeyCode = Keys.F1 Then
MsgBox("F1")
ElseIf e.KeyCode = Keys.F11 Then
MsgBox("hELLO")
ElseIf e.KeyCode = Keys.Space Then
MsgBox("Space")
ElseIf e.KeyCode = Keys.Back Then
MsgBox("BackSpace")
End If
End Subاعمل الخير وأجرك لا تنتظره فالله خير من إليك يرده
البرمجة ليست مجرد كود بل هي منهج تفكير منطقي لحل المشكلات
