2012年10月10日 星期三

c# get control by name (forms)

Reference
private Control FindControlByName(string name)
{
foreach (Control c in this.Controls) //assuming this is a Form
{
if (c.Name == name)
return c; //found
}
return null; //not found
}

沒有留言: