Click here to Skip to main content
15,877,573 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All

Why is it that the Ctrl+R not working in TextBox but in other control it is ok
VB
If e.Control And e.KeyCode = Keys.R Then
    MsgBox("r")
End If

I have a MenuStrip, theres no shortcut is set in this control

Please Help, Thanks
Posted

1 solution

I just tried it:
VB
Private Sub TextBox1_KeyDown(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
    If e.Control And e.KeyCode = Keys.R Then
        Console.WriteLine("YES!")
    End If
End Sub
And it worked exactly as I expected.
So what am I doing differently from you?
 
Share this answer
 
v2
Comments
hansoctantan 29-Apr-14 5:07am    
yup, you're right
found out why, its because of ReadOnly set to TRUE and ShortcutsEnabled set to FALSE
my bad
OriginalGriff 29-Apr-14 5:18am    
:laugh:
Get yourself another coffee! We all make mistakes :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900