Horje
handle several buttons' click events Code Example
handle several buttons' click events
    private int counter=0;

    private void CreateButton_Click(object sender, EventArgs e)
    {
        //Create new button.
        Button button = new Button();

        //Set name for a button to recognize it later.
        button.Name = "Butt"+counter;

       // you can added other attribute here.
        button.Text = "New";
        button.Location = new Point(70,70);
        button.Size = new Size(100, 100);

       // Increase counter for adding new button later.
        counter++;

        // add click event to the button.
        button.Click += new EventHandler(NewButton_Click);
   }

    // In event method.
    private void NewButton_Click(object sender, EventArgs e)
    {
        Button btn = (Button) sender; 

        for (int i = 0; i < counter; i++)
        {
            if (btn.Name == ("Butt" + i))
            {
                // When find specific button do what do you want.
                //Then exit from loop by break.
                break;
            }
        }
    }




Csharp

Related
LINQ query to select top 5 Code Example LINQ query to select top 5 Code Example
modulus program Code Example modulus program Code Example
largest prime factor C# Code Example largest prime factor C# Code Example
my context class is in different project and i want migration in different project in asp.net mvc Code Example my context class is in different project and i want migration in different project in asp.net mvc Code Example
c# 9.0 dynamic nedir Code Example c# 9.0 dynamic nedir Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
12