n999
n999

Reputation: 1

How to use Button.KeyPress in vb

what I can do to execute Button.KeyPress event in vb ?

for example Button.Click , should I press the button , so what about Button.KeyPress

Upvotes: 0

Views: 678

Answers (1)

Grahamvs
Grahamvs

Reputation: 679

Assuming you're talking about Runtime, in order to get the KeyPress event to fire, the Button needs to be first be selected, then press a (keyboard) button.

The KeyPress is normally used for things like a Textbox, it's not normally used with a Button

If you are looking for a way to force the Button.Click event, you can always call Me.Button1.PerformClick()

Upvotes: 1

Related Questions