-
Feb 2nd, 2021, 02:57 PM
#1
Thread Starter
Hyperactive Member
When enter is not Enter
I currently have a form with a text box on it. within the form I have a trigger on Enter being pressed. An example is :-
Code:
Private Sub TextBox1_Enter()
MsgBox ("enter")
End Sub
however when enter is pressed, the procedure is not triggered ?
-
Feb 2nd, 2021, 03:05 PM
#2
Re: When enter is not Enter
You seem to be confused. That Sub has nothing to do with the Enter key being pressed. It will execute when the TextBox is "entered", like when the cursor is moved to that textbox.
-
Feb 2nd, 2021, 03:12 PM
#3
Thread Starter
Hyperactive Member
Re: When enter is not Enter
That's what it generated when i selected the Enter function.
How do I detect when the enter is pressed in a text box ?
-
Feb 2nd, 2021, 03:18 PM
#4
Re: When enter is not Enter
-
Feb 2nd, 2021, 03:19 PM
#5
Re: When enter is not Enter
Originally Posted by Signalman
That's what it generated when i selected the Enter function.
How do I detect when the enter is pressed in a text box ?
Right, and the Enter function has nothing to do with detecting the pressing of the Enter key.
One way is to check for a KeyCode value of 13 inside of the KeyDown event.
-
Feb 3rd, 2021, 02:03 AM
#6
Re: When enter is not Enter
Originally Posted by OptionBase1
Right, and the Enter function has nothing to do with detecting the pressing of the Enter key.
One way is to check for a KeyCode value of 13 inside of the KeyDown event.
I'd rather use the KeyUp-Event, since there the entered KeyCode is already part of the content of the Textbox
Last edited by Zvoni; Tomorrow at 31:69 PM.
----------------------------------------------------------------------------------------
One System to rule them all, One Code to find them,
One IDE to bring them all, and to the Framework bind them,
in the Land of Redmond, where the Windows lie
---------------------------------------------------------------------------------
People call me crazy because i'm jumping out of perfectly fine airplanes.
---------------------------------------------------------------------------------
Code is like a joke: If you have to explain it, it's bad
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|