oDataSet = new DataSet(); //now am reading the files from the path that is selected XmlReadMode omode = oDataSet.ReadXml(PathSelection); for (int i = 0; i < oDataSet.Tables[2].Rows.Count; i++) { string comment = oDataSet.Tables["data"].Rows[i][2].ToString(); string font = Between(comment, "[Font]","[/Font]"); string datestamp = Between(comment, "[DateStamp]", "[/DateStamp]"); string commentVal = Between(comment, "[Comment]", "[/Comment]"); string[] row = new string[] { oDataSet.Tables["data"].Rows[i][0].ToString(), oDataSet.Tables["data"].Rows[i][1].ToString(), font, datestamp, commentVal };code that i tried that didn't work for meforeach (DataGridViewRow _gd in Gridview_Input.Rows) { DataRow _row = oDataSet.Tables["data"].NewRow(); _row[0] = oDataSet.Tables["data"].Rows[0][0].ToString(); if (_gd.Cells[1].Value.ToString() != null) _row[1] = _gd.Cells[1].Value.ToString(); if (_gd.Cells[2].Value.ToString() != null) _row[2] = _gd.Cells[2].Value.ToString(); if (_gd.Cells[3].Value.ToString() != null) _row[3] = _gd.Cells[3].Value.ToString(); if (_gd.Cells[4].Value.ToString() != null) _row[4] = _gd.Cells[4].Value.ToString(); oDataSet.Tables["data"].Rows.Add(_row); Gridview_Input.Rows.Add(_row); }
foreach (DataGridViewRow _gd in Gridview_Input.Rows) { DataRow _row = oDataSet.Tables["data"].NewRow(); _row[0] = oDataSet.Tables["data"].Rows[0][0].ToString(); if (_gd.Cells[1].Value.ToString() != null) _row[1] = _gd.Cells[1].Value.ToString(); if (_gd.Cells[2].Value.ToString() != null) _row[2] = _gd.Cells[2].Value.ToString(); if (_gd.Cells[3].Value.ToString() != null) _row[3] = _gd.Cells[3].Value.ToString(); if (_gd.Cells[4].Value.ToString() != null) _row[4] = _gd.Cells[4].Value.ToString(); oDataSet.Tables["data"].Rows.Add(_row); Gridview_Input.Rows.Add(_row); }