Results 1 to 3 of 3

Thread: Button Click causing Enter Key being pressed

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2010
    Posts
    89

    Exclamation Button Click causing Enter Key being pressed

    Hello,

    I'm creating a web browser and I was wondering how I could make a button click cause the enter key to be pressed after without having to do it yourself on the keyboard.

    Code:
    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
    
        End Sub
    Thank you in advance.

  2. #2
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    25,464

    Re: Button Click causing Enter Key being pressed

    you can use sendkeys to simulate a keypress:

    vb Code:
    1. SendKeys.Send("~")

    but if you use it in a button's click event, it'll be the button that receives the keystroke as sendkeys sends to the active control.

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2010
    Posts
    89

    Re: Button Click causing Enter Key being pressed

    Ok thank you very much.

    Works perfectly ;D
    Last edited by .:[C]4r[N]aGe:.; Feb 14th, 2012 at 01:37 PM.

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