Results 1 to 8 of 8

Thread: [2008] Press Enter

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    14

    [2008] Press Enter

    I am working on a web browser, when you enter the URL into the text box, you cannot press enter and it work, you have to click the go button. How would I make the enter button get the browser to navigate?

  2. #2
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Re: [2008] Press Enter

    In the TextBox's KeyDown event you can check for the enter key and fire away!

    Edit: Do'h, accidently said to use TextChange. Fixed (stole Atheist's suggestion).
    Last edited by Kasracer; Feb 23rd, 2008 at 06:01 PM.
    KrisSiegel.com - My Personal Website with my blog and portfolio
    Don't Forget to Rate Posts!

    Free Icons: FamFamFam, VBCorner, VBAccelerator
    Useful Links: System.Security.SecureString Managed DPAPI Overview Part 1 Managed DPAPI Overview Part 2 MSDN, MSDN2, Comparing the Timer Classes

  3. #3
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2008] Press Enter

    Handle the TextBox' KeyDown event and do this:
    VB.Net Code:
    1. If e.KeyCode = Keys.Enter Then
    2.     WebBrowser1.Navigate(TextBox1.Text)
    3. End If
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  4. #4
    Frenzied Member obi1kenobi's Avatar
    Join Date
    Aug 2007
    Posts
    1,091

    Re: [2008] Press Enter

    Or you can even set the form's Accept Button property to the Go button, so every time you press Enter, the Go buton will receive a click.

  5. #5

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    14

    Re: [2008] Press Enter

    Quote Originally Posted by Atheist
    Handle the TextBox' KeyDown event and do this:
    VB.Net Code:
    1. If e.KeyCode = Keys.Enter Then
    2.     WebBrowser1.Navigate(TextBox1.Text)
    3. End If
    Can that piece of code just go anywhere?

  6. #6
    Raging swede Atheist's Avatar
    Join Date
    Aug 2005
    Location
    Sweden
    Posts
    8,018

    Re: [2008] Press Enter

    Quote Originally Posted by hah3303
    Can that piece of code just go anywhere?
    No, it was intended for the TextBox' KeyDown event-handler.
    Rate posts that helped you. I do not reply to PM's with coding questions.
    How to Get Your Questions Answered
    Current project: tunaOS
    Me on.. BitBucket, Google Code, Github (pretty empty)

  7. #7

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    14

    Re: [2008] Press Enter

    Okay, how do I get to that area?

  8. #8

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    14

    Re: [2008] Press Enter

    Nevermind, I found it.


    Edit: Okay, great! Wow, I have learned a lot from this forum .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width