public static void GetControl(Control.ControlCollection ctc)
{
foreach (Control ctl in ctc)
{
//当窗体上的控件有子控件时,需要用递归的方法遍历,才能全部列出窗体上的控件
string s = ctl.GetType().ToString();
//MessageBox.Show(s);
switch (ctl.GetType().ToString())
{
case "System.Windows.Forms.TextBox":
{
foreach (Control ctl in ctc)
{
//当窗体上的控件有子控件时,需要用递归的方法遍历,才能全部列出窗体上的控件
string s = ctl.GetType().ToString();
//MessageBox.Show(s);
switch (ctl.GetType().ToString())
{
case "System.Windows.Forms.TextBox":
TextBox txt = ctl as TextBox;
//设置控件的属性值