how do I create a textbox click event function in c#? basically, whats the c# equivalent to vb.net's TextBox1_Click().
Printable View
how do I create a textbox click event function in c#? basically, whats the c# equivalent to vb.net's TextBox1_Click().
this.TEXTBOXNAME.Click += after this click Tab key . It will create a delegate and wires up an event handler .This is one of the features C# has over VB.NET in the IDE.
You can also get a list of events in the propertybox in the formdesigner. If you doubleclick the field an eventhandler is created for you.
Indeed. If you look closely the eventhandler assignment for controls you double-click on takes place in the Designer generated code section, so while it looks neater in your part of the code it is actually doing exactly the same thing.
typed that off the top of the head so case might be a bit wrong ;)Code:myTextbox.Click += new EventHandler(eventHandler);
void eventHandler(object Sender, EventArgs e)
{
//
}
thanks.