private void createXML() { DataTable dt = new DataTable(); foreach (DataGridViewColumn col in dataGridView1.Columns) { dt.Columns.Add(col.HeaderText); } foreach (DataGridViewRow row in dataGridView1.Rows) { DataRow dRow = dt.NewRow(); foreach (DataGridViewCell cell in row.Cells) { dRow[cell.ColumnIndex] = cell.Value; } dt.Rows.Add(dRow); } DataSet ds = new DataSet(); ds.Tables.Add(dt); ds.WriteXml(@"D:/HostAdded.xml"); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)