How do i add delete key events in winform label control?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
I have one label control in my form. I want to select that label control at run time and press delete key from key. In that event, I want to do something. How do I do that? How do I attach delete key events on label control in winform
I found only Label.KeyDown event in MSDN library. And I found this,this event is not intended to be used directly from your code. I want to do that way. How do I do? is it possible

Regards
 
Hi jh,

Label doesn't provide KeyDown event. Strangely you can find it in MSDN if
you type Label.KeyDown, but it is not listed along with the others Label
events. The reason it is not listed is because the label control never fires
key events as long as it never receives the input focus. FYI Other control
that never receives the focus and doesn't fire those events is the Panel.

Couple of weeks ago similar question was asked for the panel control. Back
then I gave solution for it.
The same solution can be used for label controls as well.

Look at this thread.
http://groups.google.ca/groups?hl=e...oitcho&meta=group%3Dmicrosoft.public.dotnet.*

I believe it will do for you. However, bare in mind that label control is
not meant to receive the focus, thus it doesn't provide any visual feedback
to the user when it is focused. This can be really confusing for the user.

--
HTH
B\rgds
100 [C# MVP]

jh said:
Hi,
I have one label control in my form. I want to select that label
control at run time and press delete key from key. In that event, I want to
do something. How do I do that? How do I attach delete key events on label
control in winform?
I found only Label.KeyDown event in MSDN library. And I found this,this
event is not intended to be used directly from your code. I want to do that
way. How do I do? is it possible?
 
Hi Stoitcho Goutsev
Thank you for your answer. I read the link and I got the way how to do
Regards
jh
 
Back
Top