By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,994 Members | 1,080 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,994 IT Pros & Developers. It's quick & easy.

Key Processing Question

P: n/a
Hi all, I've been working on a little app some friends and I need to
help us enter a lot of XML data. There are a few places where html
code is entered in, and it's silly to keep typing <b>, </b> etc. My
plan was to set it up where you could just hit ctrl+b/ctrl+i (for
<i></i>) and it would toggle between the open and close tags, OR if
there is text selected, will return that text enclosed by the
appropriate tags.

It works. Sort of...

The problem is that the bold key works perfectly, exactly what I
wanted. Meanwhile, the italics key, which uses the EXACT SAME CODE as
the bold key, inserts a bunch of spaces/tabs or something, and erases
text in the box when it does it. I notice that in an empty textbox or
richtextbox, hitting Ctrl+I seems to do a long tab (about 8 spaces or
so).

Is this Ctrl+I something I'm not going to be able to override? I've
been googling for about an hour now and still haven't come up with a
solution for this. If anyone can help, I'd greatly appreciate it.

May 15 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Well, Ctrl-I is the standard keystroke for Tab. (As defined in the
original ASCII standard, circa 1960)

Where (into what?) are you entering the text, and how are you capturing
the Ctrl-I ?

May 15 '06 #2

P: n/a
On 15 May 2006 13:44:39 -0700, "ja**********@gmail.com"
<ja**********@gmail.com> wrote:
Well, Ctrl-I is the standard keystroke for Tab. (As defined in the
original ASCII standard, circa 1960)

Where (into what?) are you entering the text, and how are you capturing
the Ctrl-I ?


Into a textbox control on a windows form, and capturing it with
OnKeyUp. Is there some simple way I can cancel the default behavior of
this keystroke? I know it's possible because most word processors do
it...

May 15 '06 #3

P: n/a
hi. OnKeyUp takes a single parameter of type KeyEventArgs. have a look in the
documentation at KeyEventArgs.Handled and KeyEventArgs.SupressKeyPress.

for example if you do the following you can "swallow" and Ctrl+I key presses..

if (e.KeyCode == Keys.I && e.Control)
e.Handled = true;

May 16 '06 #4

P: n/a
On Tue, 16 May 2006 00:20:01 -0700, Kevin Hector
<ke*********@newsgroups.nospam> wrote:
hi. OnKeyUp takes a single parameter of type KeyEventArgs. have a look in the
documentation at KeyEventArgs.Handled and KeyEventArgs.SupressKeyPress.

for example if you do the following you can "swallow" and Ctrl+I key presses..

if (e.KeyCode == Keys.I && e.Control)
e.Handled = true;


I'd been looking at the Handled thing, but I still can't get it to
work. Using your example there, would I put that before or after the
code I want executed when you hit Ctrl+I?

Thanks for the replies everybody, by the way.

Gene
May 18 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.