samedi 12 septembre 2015

Change text of a dynamically created checkbox

In C#, how do I add an event to change the checkbox's text when clicked? My code calls the "criarCheckBox" when it needs to but I cant refer to it to add the action.

    public void criarCheckBox(String nome, String texto)
    {
        CheckBox box = new CheckBox();
        box.Name = nome;
        box.Text = texto;
        listaCheckBox.Add(box);
        box.CheckedChanged += new EventHandler(checkBoxClick);
    }

    void checkBoxClick(object sender, EventArgs e)
    {

    }




Aucun commentaire:

Enregistrer un commentaire