日期:2014-05-18 浏览次数:20700 次
namespace _11 { public partial class Form1 : Form { Config config;//加这一句 public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { //Config config = new Config(this .dataGridView1 ); //这一句不要了 DataTable dt = config.DT; DataRow xinhang = dt.NewRow(); //这是要增加的行 xinhang["姓名"] = "陈中"; //到这里就通不过了. xinhang["性别"] = "男"; dt.Rows.Add(xinhang); } private void Form1_Load(object sender, EventArgs e) { config = new Config(this.dataGridView1); //前面的声明去掉 config . LoadFromFile(); } } }