I have some controls in my form inside a panel. I want to get value of any control if I know the name of that control which is Inside that Panel. So I did following effort....
foreach (Control ch in pnl.Controls)
{
if (ch.Name == "ControlName")
MessageBox.Show(ch.Text);
}
But this code loop through all the controls inside that panel, that's not my exact requirement. I want to find that control without any loop.
May be my question looks like duplicate of this post, but that post is helpful when you already know that your desired control is TextBox. What if I don't know the type of my control ?