Trap ENTER in textbox with an Accept Button set

Z

Zytan

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.
 
Z

Zytan

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
 
Z

Zytan

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top