how to export contents datagridview to an XML file
C#
4
Posts
2
Posters
0
Views
1
Watching
-
Hi All ! I want to save the content(Row And Column Cell) from a DatGridView To A XML file .how can i do it ? thanks in advance for any Help !
-
Hi All ! I want to save the content(Row And Column Cell) from a DatGridView To A XML file .how can i do it ? thanks in advance for any Help !
-
thanks , but there is no database or datasource for DataGridView , the user fill only the cells and I want to save this to an XML File . thanks RGDS!
-
Here is my code , plz help me !
SaveFileDialog saveDialog = new SaveFileDialog(); saveDialog.Filter = "Xml files (\*.xml)|\*.xml"; saveDialog.FilterIndex = 2; saveDialog.RestoreDirectory = true; saveDialog.InitialDirectory = "d:\\\\"; saveDialog.FileName = "XML File"; saveDialog.Title = "XML Export"; if (saveDialog.ShowDialog() == DialogResult.OK) { string OutPutXMLFile = ""; System.Xml.XmlDocument XMLDoc = new System.Xml.XmlDocument(); for (int i = 0; i < DataGridView1.Rows.Count; i++) { OutPutXMLFile = ""; for (int j = 0; j < DataGridView1.Columns.Count; j++) OutPutXMLFile += String.Format("{0:0.00}", DataGridView1.Rows\[i\].Cells\[j\].Value); XMLDoc.CreateElement(OutPutXMLFile); } }
but I've got an Error to create a xml file ! thanks !