Hello!
I have created a Control that consist of a label and a textbox.I have called
this class ctlLabelTextbox.
public partial class ctlLabelTextbox : UserControl
{
....
}
The class that I have created for this purpose is derived from class
UserControl.
I can then drag this control from the toolbox into the form. This works
good.
Now to my question I want to be able to fetch KeyDown, KeyUp and KeyPress
in the form so when somebody write something in my created ctlLabelTextbox
textbox
an event handler should be called to process this.
This is what I have done.
Drag my created control from the toolbox into the form.
Focus the control and list the all the event by using properies for this
control and here I have the three event that I'm looking for
KeyDown,KeyPress and KeyUp.
I have double click for each of these so these three eventhandler was
created.
private void ctlLabelTextbox1_KeyDown(object sender, KeyEventArgs e)
{
Console.WriteLine("In ctlLabelTextbox1_KeyDown");
}
private void ctlLabelTextbox1_KeyPress(object sender, KeyPressEventArgs e)
{
Console.WriteLine("In ctlLabelTextbox1_KeyDown");
}
private void ctlLabelTextbox1_KeyUp(object sender, KeyEventArgs e)
{
Console.WriteLine("In ctlLabelTextbox1_KeyDown");
}
I have set a breakpoint in these eventhandler and write something in the
ctlLabelTextbox textbox
but there is no call to any of these event handler.
So can somebody tell me why is not these handler called?
What is it that I must add because something is missing?
//Tony