read xml into datagrid view and display the file name as well

jdluken

New Member
I need to write the xml files into datagrid view , I was able to do that , but what i need also is to write to the datagridview and next to every row , the file name from where im reading the values from xml , example if have an xml file named : AIO.xml , i want to read the values of the xml and add a column to the datagrid view that displays the name : AIO and so on the code that reads all the xml files and displays there values in the datagrid view is below :\[code\] Try Dim dt As New DataTable With {.TableName = "Customers"} Dim ds As New DataSet ListBoxit.Items.Add(FileName) For Each item In ListBoxit.Items If dt.Columns.Count = 0 Then ds.ReadXml(item.ToString) dt = ds.Tables(0) Else ds.ReadXml(item.ToString) dt.Merge(ds.Tables(0), True) End If Next DataGridView1.DataSource = dt Label10.Text = DataGridView1.RowCount\[/code\]
 
Back
Top