How to disable CTRL-I as a tab in Rich Text Box

Snow

New member
Joined
Oct 31, 2008
Messages
2
Programming Experience
1-3
Hi,

got a problem here when using a Rich Text Box in VB.

I've finished writing the function which will take a selection of text and convert them into italics. However, when I write the code to bind them to CTRL-I, the default action that is taken with CTRL-I is to insert a TAB into the Rich Text Box.

How do I override this behaviour that is tied to CTRL-I ?

Appreciate any help. Thanks!
 
Use the KeyDown event to detect Control and I key from KeyCode, set Handled and SuppressKeyPress to True. The properties I mention are all available from the event parameter.
 
Another suggestion would be to use the KeyPress event and you can check for the ctrl key using e.Modifiers and the I key with e.KeyChar.

This way you're specifically looking for Ctrl + I and all other Ctrl + <Letter> combination's will still work.
 
KeyPressEventArgs doesn't have a Modifiers property.
 
Back
Top