I have list of my textbox names.
I want to find control by name.
How it possible ?
I have list of my textbox names.
I want to find control by name.
How it possible ?
You can use:
f.Controls[name];
Where f
is your form variable. That gives you the control with name name
.
Use Control.ControlCollection.Find.
TextBox tbx = this.Controls.Find("textBox1", true).FirstOrDefault() as TextBox;
tbx.Text = "found!";
EDIT for asker:
Control[] tbxs = this.Controls.Find(txtbox_and_message[0,0], true);
if (tbxs != null && tbxs.Length > 0)
{
tbxs[0].Text = "Found!";
}