473,321 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,321 software developers and data experts.

Check if user pressed Enter (Return)

I have a textbox where u have to input an URL and when u press on a "GO"
button, my browser window navigates to the URL, but if the textbox is in
focus and I finish typing the URL, and then press Enter, I want to the
browser to navigate too.
How can I do this? I think it has something to do with e.keypress or
something but I'm not sure...
Please help me.
Nov 27 '05 #1
6 9160
I am trying to do something similar. Follow my posts yesterday (Why Doesn't
13 Equals 13?) and my post today (Problem With GetNextControl).

Bob

"rpgfreak" <rp******@discussions.microsoft.com> wrote in message
news:55**********************************@microsof t.com...
I have a textbox where u have to input an URL and when u press on a "GO"
button, my browser window navigates to the URL, but if the textbox is in
focus and I finish typing the URL, and then press Enter, I want to the
browser to navigate too.
How can I do this? I think it has something to do with e.keypress or
something but I'm not sure...
Please help me.

Nov 27 '05 #2
Use the KeyPress event for the text box. Then I think you do something
like:

if e.keypress=chr(13) then GoNavigate

or maybe it's e.keychar. I don't know. I don't have VS open right now to
check.
"rpgfreak" <rp******@discussions.microsoft.com> wrote in message
news:55**********************************@microsof t.com...
I have a textbox where u have to input an URL and when u press on a "GO"
button, my browser window navigates to the URL, but if the textbox is in
focus and I finish typing the URL, and then press Enter, I want to the
browser to navigate too.
How can I do this? I think it has something to do with e.keypress or
something but I'm not sure...
Please help me.

Nov 27 '05 #3
Yeah something like that, I used something else, it used the value of 851981,
but it worked
Nov 27 '05 #4
Right, I checked the code now, it was:

If e.KeyChar.GetHashCode = 851981 Then

'CODE HERE

endif
Nov 27 '05 #5
you could also do it in the keydown event, so theres no memorizing key numbers

if e.keycode = keys.enter then

''do stuff here

end if

--
-iwdu15
Nov 27 '05 #6
then i used combobox keypress event instead of textbox
example:
Private Sub cboAddress_KeyPress(ByVal sender As System.Object, ByVal e
As System.Windows.Forms.KeyPressEventArgs) Handles cboAddress.KeyPress
If Asc(e.KeyChar) = Keys.Enter Then
Dim bFound As Boolean
bFound = False
For i As Integer = 0 To cboAddress.Items.Count - 1
If cboAddress.Items(i) = "http://" & cboAddress.Text Then
bFound = True
Exit For
End If
Next
If bFound = False Then
cboAddress.Text = "http://" & cboAddress.Text.ToString
End If
AxWebBrowser1.Navigate(cboAddress.Text)
End If
End Sub

regards
rpgfreak wrote:
I have a textbox where u have to input an URL and when u press on a "GO"
button, my browser window navigates to the URL, but if the textbox is in
focus and I finish typing the URL, and then press Enter, I want to the
browser to navigate too.
How can I do this? I think it has something to do with e.keypress or
something but I'm not sure...
Please help me.

Nov 30 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Byron McClain | last post by:
.... is being consumed. I added an event handler for the "keypress" event and my delegate never gets executed. Why? I am trying to catch the "enter" key pressed event to prevent the DataGrid...
2
by: buran | last post by:
Dear ASP.NET Programmers, I have a question about a script I'm trying to code and invoke when a button (btnSave) is pressed on the page. This script should only run when a textbox (txtAD) on the...
51
by: moosdau | last post by:
my code: do { printf("please input the dividend and the divisor.\n"); if(!scanf("%d%d",&dend,&dor)) { temp1=1; fflush(stdin); } else
6
by: Stefan Mueller | last post by:
With the following code I can figure out if 'Enter' has been pressed: ... onKeyPress = "if (check_enter(event)) {alert('Enter has been pressed');}" function check_enter(eventobjekt) { var...
2
by: matthewr | last post by:
In Internet Explorer, for example, when you hit return in the address bar, the Go button is pressed. In my program, I have a toolstrip with a textbox and button. How do I ensure the button is...
5
by: eyoung | last post by:
I have a function to check a string to make sure it is 6 digites using the trigger onBlur="CkFrmt(this)" Problem is I've got 4 fields in a row...if I enter a wrong number in the first and hit tab...
7
by: hlubenow | last post by:
Hello, I'd like to check, if a single key is pressed on a Linux xterm. This code waits for a key to be pressed and returns the character: -------------------------------------------- ...
19
Frinavale
by: Frinavale | last post by:
Filtering user input is extremely important for web programming. If input is left unfiltered users can input malicious code that can cripple your website. This article will explain how to make...
5
by: hammer45 | last post by:
Modify payroll program so that it uses a class to store and retrive the employee's name, hourly rate and the number of hours worked. Use a constructor to initialize the employee information, and a...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.