Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Enter key/CR behavior on ActiveX control

Posted on 1999-06-24
2
Medium Priority
?
361 Views
Last Modified: 2008-03-10
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.

0
Comment
Question by:minime
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 
LVL 10

Accepted Solution

by:
viktornet earned 100 total points
ID: 1519543
try this....

use the SendMessage() Win32 API... here is an example...

in OnKeyPress() do this....

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

this will move to the next control on the form...

..-=ViKtOr=-..
0
 
LVL 10

Expert Comment

by:viktornet
ID: 1519544
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=-..
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

704 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question