Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

dynamic add event control c#

private void Form1_Load(object sender, EventArgs e)
{
    Button b = new Button();
    b.Click += new EventHandler(ShowMessage);
    Controls.Add(b);
}

private void ShowMessage(object sender,EventArgs e)
{
    MessageBox.Show("Message");
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #dynamic #add #event #control
ADD COMMENT
Topic
Name
6+7 =