//XML读取 private void button4_Click(object sender, EventArgs e) { XmlConfigUtil util = new XmlConfigUtil("1.xml"); this.textBox1.Text = util.Read("information", "name"); this.textBox2.Text = util.Read("information", "class"); this.textBox3.Text = util.Read("information", "sex"); this.textBox4.Text = util.Read("information", "year"); }
//xml写入 private void button3_Click(object sender, EventArgs e) { //初始化XML XmlConfigUtil util = new XmlConfigUtil("1.xml"); util.Write(this.textBox1.Text, "information", "name"); util.Write(this.textBox2.Text, "information", "class"); util.Write(this.textBox3.Text, "information", "sex"); util.Write(this.textBox4.Text, "information", "year"); util.Write(this.textBox1.Text, "information2", "name"); util.Write(this.textBox2.Text, "information2", "class"); util.Write(this.textBox3.Text, "information2", "sex"); util.Write(this.textBox4.Text, "information2", "year"); util.Write(this.textBox1.Text, "name"); util.Write(this.textBox2.Text, "class"); util.Write(this.textBox3.Text, "sex"); util.Write(this.textBox4.Text, "year"); }