Home > database >  Name of a Control
Name of a Control

Time:11-13

Can I ask for help on something that has me really puzzled? I have written a small function to demonstrate:

void Test()
{
    CheckBox checkBox1 = new CheckBox();
    string temp = checkBox1.Name;
}

temp is an empty string after this has run. Since "checkBox1" is not the Name of the control what is it?

CodePudding user response:

checkBox1 is a variable name or an instance name of the CheckBox class, e.g. I have a pet dog (class), its name is Benji (variable name).

.Name is a property of this CheckBox control, a piece of information you can store in this control. See Programmatically added checkbox on the main form.

  • Related