Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i am using below code for grid view but its give an error "Unable to cast object of type 'System.Data.DataTable' to type 'System.Collections.IEnumerable".



Private Sub Btn_Show_Click(sender As Object, e As RoutedEventArgs)

Dim xmlFile As XmlReader
Dim Searchresults As New List(Of SearchResultsSubject)()
xmlFile = XmlReader.Create("Data.xml", New XmlReaderSettings())
Dim ds As New DataSet
ds.ReadXml(xmlFile)
Dim i As Integer
For i = 0 To ds.Tables(0).Rows.Count - 1

dGridResults.ItemsSource = ds.Tables(0)
Next

End Sub
Posted

1 solution

Hi, Use
C#
dGridResults.ItemsSource = ds.Tables(0).DefaultView
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900