Hi David:
This is another David. I have a recusive way to step though all the controls
on WinForm. All you need to do let the routine know which control you are
looking for though CallBack.
public delegate bool
WinTravelerCallBack(System.Windows.Forms.Control ctrl);
public static void WinTraveler(System.Windows.Forms.Control
ctrls,WinTravelerCallBack winCallBack)
{
foreach(System.Windows.Forms.Control ctrl in ctrls.Controls)
{
// System.Diagnostics.Debug.WriteLine(ctrl.Parent.Nam e + "
" + ctrl.Name);
if (winCallBack(ctrl))
{
if (ctrl.HasChildren)
WinTraveler(ctrl,winCallBack);
}
else
break;
}
}
"Morten Wennevik" wrote:
Hi David,
foreach(Control c in panel1.Controls)
{
if(c is TextBox)
// do stuff, if necessary, cast to TextBox
}
--
Happy coding!
Morten Wennevik [C# MVP]