CodeDom之类的类去动态编译,动态语言吧

解决方案 »

  1.   

    我有一个combobox里有两个选项A和B 
      在cmbobox里选择A  就显示label1  
      选择B  就显示label2 我写了个方法 
        public void addlabelDate() 
            { 
                Label label1 = new Label(); 
                label1 .AutoSize = true; 
                label1 .Location = new System.Drawing.Point(26, 44); 
                label1 .Name = "labelDate"; 
                label1 .Size = new System.Drawing.Size(29, 12); 
                label1 .TabIndex = 0; 
                label1 .Text = "日期"; 
                this.groupBox2.Controls.Add(label1); 
            } 然后在这里调用 
      private void comboBoxCycle_TextChanged(object sender, EventArgs e) 
            { 
                addlabelDate(); 
            } 
    但是显示不出来