469,927 Members | 1,627 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,927 developers. It's quick & easy.

Trap ENTER in textbox with an Accept Button set

Hello everyone,

I would like to trap the ENTER key press in a RichTextBox, when it is
in focus. I have an Accept Button set, which grabs it. In Win32, I
could use the WM_GETDLGCODE Notification to accomplish this, but I am
unsure where that functionality exists in VB .NET. Handling the
KeyPress event doesn't work, as it doesn't even get a chance to be run
-- the Accept Button grabs it first.

Any sources of information would be appreciated. But, I'll continue
searching until then...

Thanks,

Zytan.

Jan 29 '07 #1
2 6853
Basically, I want to be able to TYPE in a textbox or RichTextBox,
using TAB and ENTER, while also having an Accept Button, and have
normal TAB behaviour for the rest of the dialog.

Any thoughts?

Zytan

Jan 31 '07 #2
I figured this out.

RichTextBox1.AcceptsTab = True

Other controls have AcceptsTab and AcceptsReturn, but the RichTextBox
control is special... AcceptsTabs means both TAB and ENTER.

Zytan

Feb 9 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Phillip Kennedy | last post: by
6 posts views Thread by André Almeida Maldonado | last post: by
2 posts views Thread by R Tipton | last post: by
3 posts views Thread by David Lozzi | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.