alansiqueira27
alansiqueira27

Reputation: 8506

How to Capture keydown event of a Label?

I added the event, I click in the label and press any key, but it doest go to the method. How can I capture?

Upvotes: 0

Views: 1787

Answers (3)

Nick
Nick

Reputation: 9183

To add content beyond my other comment. Have you looked at something like input bindings for what you are trying to do?

http://msdn.microsoft.com/en-us/library/system.windows.input.inputbinding.aspx

Upvotes: 0

Steve Wellens
Steve Wellens

Reputation: 20620

Maybe you could disguise a text box to look like a label.

Upvotes: 1

asawyer
asawyer

Reputation: 17808

I don't think labels can receive keyboard input. It will go to the control with focus, and labels can never have focus (by default, I guess you might pull some shenanigans though), most likely your events are going to your main form.

Upvotes: 3

Related Questions