Trap ENTER in textbox with an Accept Button set

  • Thread starter Thread starter Zytan
  • Start date Start date
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.
 
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
 
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
 
Back
Top