Link to home
Start Free TrialLog in
Avatar of minime
minime

asked on

Enter key/CR behavior on ActiveX control

I'm using the following function such that the enter key would behave just like the tab key, allowing users to move from one textbox to another.

If KeyAscii = 13 then
 KeyAscii = 0
 CRToTab = True
 SendKeys "{TAB}", wait:= True
Endif

I call this function on the Keypress event of the textbox. However, when I hit the enter key, it leaves a vertical line trail mark on the textbox. It does this as the cursor blinks and the vertical line is showing.

I tried replicating this on an ordinary form and this weird behavior doesn't happen. When I launch my User Document on a web browser, it happens.

ASKER CERTIFIED SOLUTION
Avatar of viktornet
viktornet
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
oppps, i see a little typo in the above message ;-))

call SendMessage(Form1.hWnd, WM_NEXDLGCTL, 0, 0)

should've read

call SendMessage(Form1.hWnd, WM_NEXTDLGCTL, 0, 0)

the WM_NEXTDLGCTL was misspelled...

..-=ViKtOr=-..