Search
 
SCRIPT & CODE EXAMPLE
 

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");
}
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# convert string to datetime dd-mm-yyyy hh-mm-ss 
Csharp :: remove string inside curly braces C# 
Csharp :: c# selenium xunit testing 
Csharp :: number to character c# 
Csharp :: unity gun clipping through walls 
Csharp :: wpf binding object get value 
Csharp :: administration 
Csharp :: Create a button in unity to show ad 
Csharp :: c# .net core entity framework one to many 
Csharp :: c# enum get string value 
Csharp :: Unlit shader get the direction of camera UNity 
Csharp :: how to access resources in c# 
Csharp :: serial begin 
Csharp :: c# builder pattern fluent example 
Csharp :: w3develops 
Csharp :: c# copy bidimensional array 
Csharp :: HtmlToPdfConverter 
Csharp :: Popup open close wpf 
Csharp :: run in wpf 
Csharp :: unity normalize 
Csharp :: remove all values from list c# 
Csharp :: how to display a form when a button click c# windows form 
Csharp :: change physics material unity 
Csharp :: get xml from url 
Csharp :: asp.net web forms 
Csharp :: c# list empty 
Csharp :: wpf dispatcher timer is inaccurate 
Csharp :: what does focusbale do in listview WPF 
Csharp :: hive survive 
Csharp :: erewt 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =