saying i have a defined button click event and i want to trigger (or call ) it from the code.
any example ?
How to trigger an event from the code in c#?
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Kirtan PatelRank #292 · 8.6K reputationPosted Dec 17, 2009, 8:52 AM EST
private void Form1_Load(object sender, EventArgs e)
{
//define Event handler Handler
button1.Click +=new EventHandler(button1_Click);
}
//define method Which will run when you click button
public void button1_Click(Object Sender, EventArgs e)
{
//Write Whatever you want to perform on button Click
}