I want to add a ; at the end of the current line I'm typing on by using ctrl+end or other keys.. im using a richtextbox.. Thanks in Advance!
Printable View
I want to add a ; at the end of the current line I'm typing on by using ctrl+end or other keys.. im using a richtextbox.. Thanks in Advance!
I'm not exactly clear on what you're asking but here's code to use the Alt key, Ctrl key and F1 key, etc.
In my application I have a boolean variable ControlPresssed. If the control key is pressed ControlPressed is set to true and stays true for a couple seconds and if a certain other key is pressed while ControlPressed is true then I make something or other happen. That way you don't have to hold 2 keys down together but you can do things however you like.Code:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.Alt Then
' Code to do this that or the other thing when Alt key is pressed
Select Case e.KeyCode
Case Keys.End
' Code to perform when Alt key and End key are pressed at the same time
Case Keys.Home
' Code to perform when Alt key and Home key are pressed at the same time.
End Select
End If
Select Case e.KeyCode
Case Keys.ControlKey
' Code to perform when Control key is pressed
Case Keys.Escape
' Code to perform when Escape key is pressed
Case Keys.F1
' Code to performed when F1 key is pressed
Case Keys.F2
' Code performed when F2 key is pressed
Case.Keys.End
If e.Control Then
' If Control key and End key are pressed then do whatever
' There may be some other way to code this but this is the
' way I know.
End If
End Select
End Sub
I just rephrase it. Whenever the Enter Key is used it will add ; at the end of the current line in the richtextbox.