C#Winform關於對xml檔案的一系列操作(持續更新)
阿新 • • 發佈:2018-12-16
// 讀取xml檔案到DataTable string filepath = Application.StartupPath + @"\Previous Competitions\PreviousCompetitions.xml"; if (!File.Exists(filepath)) { MessageBox.Show("File is not exist!"); return; } try { DataSet ds = new DataSet(); ds.ReadXml(filepath); this.dataGridView1.DataSource = ds.Tables[0]; } catch (Exception ex) { MessageBox.Show("Loaddata Filed!Message:"+ex.Message.ToString()); return; }