c#中的应输入类型,命名空间定义或文件尾的错误
c#中的应输入类型,命名空间定义或文件尾的错误,程序如下:usingSystem;usingSystem.Collections.Generic;usingSystem....
c#中的应输入类型,命名空间定义或文件尾的错误,程序如下:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Add_and_Remove
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form1 f1 = new Form1();
if (labelflag == true)
{
Label l1 = new Label();
l1.Location = new Point(24, 8);
l1.AutoSize = true;
l1.Text = "new Label";
f1.Controls.Add(l1);
}
if (textboxflag == true)
{
TextBox t1 = new TextBox();
t1.Location = new point(24, 32);
t1.Size = new Size(72, 40);
t1.Text = "new TextBox";
f1.Controls.Add(t1);
}
if (buttonflag == true)
{
Button b1 = new Button();
b1.Location = new Point(24, 64);
b1.Size = new Size(48, 24);
b1.Text = "移除";
f1.Controls.Add(b1);
}
if (checkboxflag == true)
{
CheckBox c1 = new CheckBox();
c1.Location = new Point(24, 96);
c1.Size = new Size(104, 40);
c1.Text = "new CheckBox";
f1.Controls.Add(c1);
}
f1.Show();
this.Close();
Form1 f1 = new Form1();
f1.remo();}
public void remo()
{
this.Controls.Remove(button2);
this.Show();
}
}
}
} 展开
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace Add_and_Remove
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Form1 f1 = new Form1();
if (labelflag == true)
{
Label l1 = new Label();
l1.Location = new Point(24, 8);
l1.AutoSize = true;
l1.Text = "new Label";
f1.Controls.Add(l1);
}
if (textboxflag == true)
{
TextBox t1 = new TextBox();
t1.Location = new point(24, 32);
t1.Size = new Size(72, 40);
t1.Text = "new TextBox";
f1.Controls.Add(t1);
}
if (buttonflag == true)
{
Button b1 = new Button();
b1.Location = new Point(24, 64);
b1.Size = new Size(48, 24);
b1.Text = "移除";
f1.Controls.Add(b1);
}
if (checkboxflag == true)
{
CheckBox c1 = new CheckBox();
c1.Location = new Point(24, 96);
c1.Size = new Size(104, 40);
c1.Text = "new CheckBox";
f1.Controls.Add(c1);
}
f1.Show();
this.Close();
Form1 f1 = new Form1();
f1.remo();}
public void remo()
{
this.Controls.Remove(button2);
this.Show();
}
}
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询