Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RTF shortcut key.

Status
Not open for further replies.

jerasi

Programmer
Jun 19, 2000
141
CA
I have a RTF control on one of my forms, my problem is when I press CTRL + E it aligns the text to the center (default with RTF's) how can I tell when CTRL + E was pressed and make the RTF ignor it?
 
Private Sub rtfBox_KeyPress(KeyAscii As Integer)

Select Case KeyAscii
Case Is = 5
' ignore CTRL + E
KeyAscii = 0
Case Else
KeyAscii = KeyAscii
End Select

End Sub
_________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
 
I tried that and it didnt seem to work, I tried

Private Sub rtfBox_KeyPress(KeyAscii As Integer)
MsgBox KeyAscii
End Sub

I get the message box when I press any button but without the CTRL button (when i press CTRL + E the message box doesnt appear).

Jerasi
 
I'm baffled: I reproduced your code on my system (WinMe and VB6) where i created a standard form (Form1) and a standard rtf (RichTextBox1). The responses were as expected: even when trying any alphabetic key in combination with the CTRL key did produce the message box with the correct Ascii code (1 = a or A, 26 = z or Z) _________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top