Using VB.NET I'm binding a DataGridView to an XML file using this code (for reading and writing)
Dim ds As New DataSet Dim sFile As String = "C:\test.xml"
Using xmlFile As XmlReader = XmlReader.Create(sFile, New XmlReaderSettings()) ds.ReadXml(xmlFile) gridData.DataSource = ds.Tables("data") End Using
Here is what the XML looks like. Now keep in mind that I fully control the layout of the XML and can change it to fit my code:
<?xml version="1.0"?> <template validation="validationgoeshere"> <data> <digit1>0.507874</digit1> <digit2>545541</digit2> <somevalue>78</somevalue> <blah>0.015</blah> <emptyexample /> </data> </template>
I'm trying to show only one column "Data" and I want all elements within "Data" to be displayed as rows (with their appropriate values - innerXML). I dont' want to hardcode/specify the Rows, they need to be auto-populated with whatever it's in "Data". Currently it shows one row and multiple columns; how can I "flip" them?