Enos

Enos

  • 1.5k
  • 140
  • 24.7k

How do i write resource file and also be created on xml?

Feb 3 2015 5:15 AM
Hi,
 
I have resource file which the user browse the file and it get loaded on the Gridview. now i want to write the new line on the grid and click save so that it must be added on xml. Below are my code for reading xml file. i have tried to write but i didn't get it working;
 
private void btnBrowse1_Click(object sender, EventArgs e)
{
try
{
BrowseFile();
versionIncrement();
if (txtInputfile.Text.Length > 0)
{
PathSelection = txtInputfile.Text;
}
oDataSet = new DataSet();
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[] elements = comment.Split('-'); 
string font = elements[0]; 
string datestamp = elements[1]; 
string commentVal = elements[2]; 
string[] row = new string[] { oDataSet.Tables["data"].Rows[i][0].ToString(), oDataSet.Tables["data"].Rows[i][1].ToString(), font, datestamp, commentVal };
Gridview_Input.Rows.Add(row);
}
}