想把panel中的所有TextBox,ComboBox控制,转换成Label类型
        private void diversionCT()
        {
            Label lbl;
            TextBox tbxType = new TextBox();
            ComboBox cobType = new ComboBox();
            foreach (Control temp in this.cpContent.Controls)
            {
                if (temp.GetType().Equals(tbxType))
                {
                    lbl = new Label();
                    lbl.Location = (temp as TextBox).Location;
                    lbl.Text = (temp as TextBox).Text;
                    temp = lbl;
                    break;
                 }
                if (temp.GetType().Equals(cobType))
                {
                    lbl = new Label();
                    lbl.Location = (temp as ComboBox).Location;
                    lbl.Text = (temp as ComboBox).SelectedText;
                    temp = lbl;
                    break;
                }
            }           
        }
 错误 13 “temp”是一个“foreach 迭代变量”,无法为它赋值 D:\NNMessageClient\NNMessageClient\NNMessageClient\FormBasicInfo .cs 95 21 NNMessageClient
谁有更好的方法啊?