Using the Keys

I wanted to be able to click a button (Button1) while having the textbox (TextBox1) selected. I have currently:

[code]
If Keys.Enter Then
Button1.PerformClick()
End If
[/code]

This code has not been working. For some reason every time a press a key it clicks Button1. If any one could help me I would really appreciate it. Thanks!

Comments

  • : I wanted to be able to click a button (Button1) while having the textbox (TextBox1) selected. I have currently:
    :
    : [code]
    : If Keys.Enter Then
    : Button1.PerformClick()
    : End If
    : [/code]
    :
    : This code has not been working. For some reason every time a press a key it clicks Button1. If any one could help me I would really appreciate it. Thanks!
    :
    Use this to call the event of the button:
    Button1_Click(sender, e)

    What do you need to do?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion