At firstly I am fill to datagrid manually and save as Xml ,folowing this code,But if I fill to multiple rows in datagrid and then only export last rows
for (int i = 0; i < dataGridView1.Rows.Count; i++)
{
XmlTextWriter xmlDocument = new XmlTextWriter(@"d:\Deneme.xml", System.Text.Encoding.GetEncoding("ISO-8859-9"));
xmlDocument.Formatting = Formatting.Indented;
xmlDocument.Indentation = 5;
try
{
xmlDocument.WriteStartDocument();
xmlDocument.WriteStartElement("SALES_INVOICES");
xmlDocument.WriteElementString("TYPE", dataGridView1.Rows[i].Cells[0].Value.ToString());
xmlDocument.WriteEndElement();
xmlDocument.Close();
MessageBox.Show("Xml Created.");
}
catch (Exception ex)
{
MessageBox.Show("Hata" + ex.Message);
}
}
And Result is
1453
I want to result is ;
1452 1453
Thanks in advance
And Result is
I want to result is ;
Thanks in advance
Umesh KumarPosted May 19, 2014, 9:22 AM
Demir AcarPosted May 18, 2014, 2:56 PM
Umesh KumarPosted May 18, 2014, 2:47 PM
Use Below Code