Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  HOME    TRACKER    Visual Basic

Pressing Enter In Text Field

how can i make it so when someone presses enter while typing in a text box, it'll like click a command button

View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Stop The Beeping When Pressing Enter On A Field
Any one out there who can tell me
how to stop the beeping when when we press enter to
navigate the screen developed in VB6.
we are making an accounting software for our client
and there are really goin mad becuase every time
they navigate the screen by pressing enter
it give a beep. this beep comes form the speaker inside
the casing of the PC, and when cound card is there it comes
formt he sound card,plz help to solve this problem

Pressing [ENTER] In A Text Box
I would like a user to press [ENTER] in after adding info in a Text Box, but I haven't found an event "on_enter". Right now, I have a separate command button which gets the text from the testbox and manipulates it, and clears the textbox.

What is the easy way to allow entering to submit user input?



How To Move To The Next Text Box Pressing Enter Key
<html><div style='background-color:'><DIV>
<P><BR><BR>suppose i am having three text boxes. Text1, Text2, Text3</P>
<P>if i press enter key cursor should move to the next text box. .i.e. text2</P></DIV></div><br clear=all><hr>MSN Photos is the easiest way to share and print your photos: <a href=''>Click Here</a><br></html>

Move To Next Text Box By Pressing ENTER Key
I have a form with about 10 text boxes on it that the user is to fill in. Right now, the user must press the Tab key to advance to the next text box on the form. However, I would like to allow the user to also press the Enter key to accept the value that they have entered in the current text box and then advance to the next text box on the form. How do I do this?

How Do I Make A Text Box Add To A List Box When Pressing Enter?
I wanna know how to make pressing enter in a text box add the text in it to something like a label caption or a list box, how do I do this?

Pressing Enter Inside A Text Box To Close The Form.
I have a settings box that I input a number into, and then I want to be able to press the enter key and let it correspond to the OK button on the form. How do I do this?

Pressing Enter Key On Text Box Clears The Text

This is doing my head in! Should be something obviously simple but I can't get it working...

I have text box (on a tab) - properties are set to multi line.

When I run the application I start typing text but as soon as I press the enter key to move to the next line the text box is cleared.

Something to do with the textbox properties and the return key default actions?

Thanks in advance

Instead Of Pressing Clicking A Button, What About Just Pressing Enter?
Hey, once again. How do I make it so that a user doesn't have to click a button for that button's code to be performed, just when they press enter?

&lt;Enter&gt; In A Text Field
I have a text field that when I press <Enter>, it will be as though I clicked on the desired command button, but when I hold <Shift> and press <Enter> I want the text field to advance to the next line.


You guys are the best!

Enter Key In Text Box Tabs To Next Field

I am having a very strange problem.

I have a text box which the user can type data into. Recently, when the Enter key is pressed, instead of adding a new line in the text box, it Tabs to the next field.

I retried an old version (from SourceSafe) and the Enter key worked fine - yet I can't see any differences to the property of the Text box.

I also have the following event which is called for a normal keypress but not the enter key

Private Sub txtEmail_KeyPress(KeyAscii As MSForms.ReturnInteger)

I have seen several other threads with similar problems - could this be a VB6 problem???


How Can A User Enter A Crlf In A Control Text Field

Is there a way a user can enter a vbcrlf in a control to embed a crlf in a controls .text field?


Pressing Enter
Can somone help with this annoying problem.
How do i fire an event when I press a specific key (enter), and how do I make a text box lose focus using the enter key?


Pressing Enter.
after a user has entered information in my textbox, i want them to be able to just press enter to submit the input, instead of clicking on the button with the mouse.

how do i do that?

Pressing Enter
Excuse me, but I'm having a small problem with a form I'm working on. I'm trying to figure out how to make it so that when I hit enter while in a specific textbox, it will automatically click the submit button for me.

Thanks in advance,

Pressing Enter...
Is it possible to have an API call simulate the keyboard pressing the "Enter" key?

Pressing Enter
Hi how can i make my app. press "Enter Key". It's for a chat program.

When i press F9 i want my program to write:
[ENTER] Hello everybody! [ENTER]

[ENTER] = enterkey

Pressing Enter
i'm making my own web browser and the only thing i havent got to work is in the text box where you type the url, i would like the user to be able to press enter to get to their destination rather than having to click go. Does anybody know how to do this.

Add Value By Pressing Enter Key
I want a user to be able to enter a value in a textbox, and press the enter key to add the value to a listbox. The code I have now adds every key pressed to the list. I just want the value entered when the enter button is pressed.

Any help??

VB Code:
Private Sub txtWhereValue_KeyPress(KeyAscii As Integer)KeyAscii = Asc(UCase(Chr(KeyAscii)))lstIn(0).AddItem (txtWhereValue.Text)End Sub

Pressing Enter Key
how do I code such that when I person hits the enter key it is the same as selecting the OK button?

Pressing Enter
is it possible to have a form that when you fill in a text box, you can press enter, so the function of a command button is done.

Like on websites. With hotmail you fill in your user name and password, then press enter, or you can press the submit button.

Hope i have explained it enough


Pressing Enter:)
Or use SelText.

Text1.SelText = vbNewLine

Enter Value By Pressing Tab Key
<html><div style='background-color:'><DIV><FONT face=Helv color=#000000 size=2>
<P>The user entering some values in text box.after entering immediately they will press the tab now the value entered in the text box should be added to list box.</P>
<P>how i can do that? please help me,</P>
<P> </P></FONT></DIV></div><br clear=all><hr>Cool new emoticons. Lots of colour! <a href="">On MSN Messenger V6.0</a> </html>

Add Value By Pressing Enter Key
try this on for size:


Private Sub txtWhereValue_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
List1.AddItem txtWhereValue.Text
txtWhereValue.Text = ""
End If
End Sub

Pressing/holding ENTER
Im working on a mini project, mainly for the comedy value, but to also get my mind functional again for college. All you need to know is that a man runs about, or can get into a jeep that goes 2x faster than running.

My problem is this:

I want to be able to get my "man" into the "jeep" by pressing enter at the correct location, and then to exit the "jeep" by pressing enter once more. Unfortunately i have to hold enter to stay in the "jeep" and as soon as i release the enter button, the "man" exits the "jeep" . I know why this happens, but i need assistance on how to overcome the problem. Heres the relevant code:

Private Sub tmrMain_timer()
If man.Left < Jeep.Left + Jeep.Width And Jeep.Left < man.Left + man.Width Then
If man.Top < Jeep.Top + Jeep.Height And Jeep.Top < man.Top + man.Height Then
If pressreturn = True Then
If Jeep.Visible = True Then
Jeep.Enabled = False
man.Picture = Jeep.Picture
Call tmrJeep_timer
End If
End If
End If
End If
End Sub

Private Sub tmrJeep_timer()
'i tried having :
'if pressreturn = true then exit sub
'but this had undesired results

If pressup = True Then
man.Top = man.Top - 100
Jeep.Top = man.Top
End If

If pressdown = True Then
man.Top = man.Top + 100
Jeep.Top = man.Top
End If

If pressleft = True Then
man.Picture = jeep2
man.Left = man.Left - 100
Jeep.Left = man.Left
End If

If pressright = True Then
man.Picture = jeep1
man.Left = man.Left + 100
Jeep.Left = man.Left
End If
End Sub

Should I perhaps have it all in one timer?

Pressing The Enter Button?
How do I create an event for pressing the enter button on the keyboard at any time in a program?


Pressing Enter Should Execute... Why Not?
I'm trying to make a form execute a button-click sub on the strike of an enter key from a particular textbox. The button looks up a record and populates the form based on the ID number in the first field. As of now, the only way to make that sub execute is to click the button, but I would like to make it happen by just typing in the ID number and pressing the Enter key (or even the Tab key). I have tried calling the sub through KeyPress, LostFocus, Enter, etc.... all the ones that should do something, but either nothing happens at all or something weird happens. How can I set up my code to do this?

Pressing Enter Runs A Sub

i have a textbox and some combo-boxes, i would like to be able to press ENTER and have a certain sub procedure run - how do i do this?


Pressing Enter In Textbox
I want to have a multiline disabled textbox that when the user presses the Enter button, an action or function is called. I know I could work with the Textbox_Change function, but isn't there an easier way?

Pressing Enter In A Textbox
How can I have the Return key be a shortcut for a command in a form? I type in something in a textbox and hit Return, which does what a certian command does?

[VB6] SendKey Pressing ENter?
Im using
Sub Sendkey(text$, Optional wait As Boolean = False)

'wrapper for Sendkeys which does not crash in the IDE under Windows Vista
Set WshShell = CreateObject("WScript.Shell")
WshShell.SendKeys text, wait
Set WshShell = Nothing

End Sub


Sendkey Text1.text

and so far, it's working. All I want to know, is by using the code provided, how is it possible to send the 'return' key... AKA the 'enter' key.
Ive tried "{RETURN}", but got an error... Any idea's?

EDIT: Thanks anyway guys, but ive got it, and for future reference, it's
Sendkey "~"

Sound On Pressing Enter
Hi everybody,
In my entry modules, I have allowed the {Enter} key to move the cursor to the next control. But when {Enter} is pressed from a text box, the cursor does move to the next control, but a "Ding" sound occurs. Is there any way to eliminate that sound ?

Getting Rid Of The 'PING' When Pressing Enter
Hi again,

ive a textbox and a listbox
after typing in the txtbox and pressing enter the focus and cursor go to the listbox, but not without an annoying 'PING'.

how can i get rid of the PING?

How To Enter Forms Data Into A Text File In Proper Field Format
I want to use txt files for maintaining data which is enterd in the txt boxes on the form.
I want help about how can I store the data into txt files from vb code and then again retrive it in proper way
Name: abcd

the entered data 'abcd' I want to enter into txt file in proper field format
So anyone can help me?

Don't Want To Skip Line After Pressing Enter.
in my chat program if the user pressed the enter button i don't want it to skip a line. here's my code below which i thought would of worked but it doesn't.

If KeyAscii = 13 Then
wskConn.SendData txtUser.Text & ": " & txtInput.Text
txtInput.Text = ""
end if

Hitting Enter Without Pressing A CommandButton
I have made a small chat program
and I want to be able to
send the message that I type simply by pressing ENTER.
instead of having to press a "send" button.
How could this be done?

Alex Skafidas

Switchig Textboxes By Pressing Enter
i am creating a logon section to my program.

i have 2 textboxes on my form and want it so that when the user presses enter in the first it will switch to the second textbox and when the user presses enter in the second it validates the data?

can anyone help?

Pressing Enter Key And Multiline Textboxes
What code do I need to properly recreate hitting the enter key in a multiline textbox submitted from a different form?

It would go something like the following:
form2.textbox.text = "test" & chr(13) & "test2"

*This doesn't work because is shows a strange character in the box and the text is on the same line.

Would it somehow involve the SendKeys "{enter}" command and if so how?

How To Stop Beep On Pressing Enter Key
can anybody tell me how to stop irritating beep that occurs when enter keys is pressed in a text box

i have tried following code

private sub txt_KeyPress(KeyAscii as integer)
if keyascii = vbKeyReturn then
keyascii =0
end sub

What Is The Event For Pressing Enter In Textbox?
i want to know the event of textbox in which after typing something in the textbox and when i press enter key at the end, some event would call. any event in your mind

Removing The Sound When Pressing Enter On Texbox
Well, i have some textboxes with multiline setted to false ( it has to be this way ), and i also want that when the user press the ENTER ( Return ) key, it set the focus do the next textbox. The problem is that everytime that you press enter on a textbox with multiline = false, it makes a "beep", because i'm trying to go to another line on a single line textbox. How can i remove this annoying sound, withou having to change my Sound options in windows?


Eliminate Sound When Pressing &lt;Enter&gt; On A Textbox

This is my part of code:

Private Sub txtBox_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendKeys "{TAB}"
End Sub

When the user press <Enter> on the txtBox, the cursor would go to the next tab index. However, meanwhile, the sound "Ting" would come out also. Is there anyway to eliminate the sound?

Pls. advice and thanks in advance.

Automaticall Click A Button By Pressing Enter? [vb6]
exactly like the title says. i need to make my little program so when you hit enter, it will automatically "hit" a button and run the associated commands. i know how to do this in vb .net but i am not sure how i would go about doing this in vb6. any help would be greatly appreciated for someone who doesn't know jack about vb6

Moving Cursor To 2nd Line When Pressing Enter
When I press Enter key in a textbox the cursor is not going to the next line. So how to make it? Thanks.

Anoying Beep When Pressing Enter In Textbox...
Hi all.

I'm using singleline textboxes on my form and I want the user to press enter to validate his entry in the textbox. It works ok except there is always an anoying beep when ever ENTER is pressed! I think it is related to the fact that my textbox is singleline because the beep does not occur when I set my textbox to multiline; pressing ENTER creates a second line in the textbox (which I don't want).

Does any of know how to get rid of this Beep without setting the textbox to multiline?


Pressing Enter Key To Fetch Fields From Access
hi all,
        i want to know that how can i write a code in which i can press enter key to fech values from a database.
suppose i press enter key in a text box and the fieds should appear in the program. i am able to do that with a command button.

Simulate Pressing Enter For Submitting A Form

I'm trying to simulate pressing the return key to submit a form. There seems to be no other option. However, there seems to be no response from the webbrowser. What am I doing wrong? (I am able to simulate a mouse-click succesfully, but this entails obtaining the coordinates of the submitbutton)

My code looks like this:

Public Const WM_CHAR = &H102

Declare Function SendMessage Lib "user32" Alias _
"SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, _
               ByVal wParam As Long, _
               ByVal lParam As Long) As Long

SendMessage webbrowser.hWnd, WM_CHAR, vbKeyReturn, ByVal 0

Thanks in advance for your kind reply,


Simulate A Click On A Button By Pressing Enter On Keyboard
This is probably an easy one for you:

On an html form, if you can press enter on your keyboard instead of clicking with your mouse on a submit button this will submit the form, as long as the button is of type "submit" and it is the first of any other submit buttons in the form. How can I do this in VB? How can I get an OnClick event to fire for my command button when the user presses enter on the keyboard?

Also, how do I set focus to a text field? If I do it in the form_load event it doesn´t seem to work. I want to set focus to the text field when the form is loaded.

Moving To The Next Line In A Textbox (WITHOUT) Pressing Enter (return)???

I would like to press a button that will make txtInput go to the next line, How would I do this???

How To Read Barcode With Mobile Scanner Without Pressing He Enter Key???
Hi Guys

I am working on an inventory control project. Cleient wants to use the scanner to read the barcode. It works like you scan and item for stock in or stock out.

So he wants to use a mobile scanner

My question is if I set the focus to textbox and then read the barcode it will come in it. Do I need to press the enter key to save the recotd and empty text box or it will automatically save and empty the text box for next item scan?

I mean to say if the user is in the differnet room with mobile scanner in hand and keeps on scanning the items do these will be entered without pressing the return key on key board Any help please

Hope Never Ends Keep On Doing Hard Work
Jaspinder Singh

Hope Never Ends Keep On Doing Hard Work
Jaspinder Singh

Copyright © 2005-08, All rights reserved