.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Code Snippets >> ADO.NET >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Generate or create and event for a dynamic added control in GUI

Posted By:Nikhil Kumar       Posted Date: April 27, 2010    Points: 10    Category: ADO.NET    URL: http://www.dotnetspark.com  

Generate or create and event for a dynamic added control in GUI In Windows form
 

Here we learn how to add or generate a event for a control which is added dynamically.
public partial class Form1 : Form
{

    Button bt = new Button();

    public Form1()
    {
        InitializeComponent();

        bt.Click += new EventHandler(bt_Click);
    }

    private void bt_Click(object sender, EventArgs e)
    {
        MessageBox.Show("hello this is the button");

    }
}

Thanks !!!     

     

Further Readings:

Responses
Author: rajendra         Company URL: http://www.dotnetspark.com
Posted Date: July 28, 2010

its fne


Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend