1、新建窗体应用程序
2、拖放DataGridView
3、在bin\Debug中放入XML文件
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { DataSet ds = new DataSet(); ds.ReadXml("PERSON.XML"); dataGridView1.DataSource = ds.Tables["student"].DefaultView; } } }
时间: 2024-11-02 23:34:21