В winForms
добавление CSV в DataGrid
было довольно простым. Теперь я пытаюсь добавить это к Silverlight
DataGrid
. Вот моя попытка - которая дает 3 столбца Capacity|Count|Items
- помните, что значения верны 83 | 83 | _ на каждой строке. Есть 83 строки, но столбцы должны быть 23 с значениями diff в каждом. Спасибо, что посмотрели и наслаждались щедростью!Импорт CSV в DataGrid
Код:
Try
Dim ofd As New OpenFileDialog
If ofd.ShowDialog Then
If IO.File.Exists(ofd.File.FullName) Then
Dim srsCol As New List(Of List(Of String))
Using fs As IO.FileStream = ofd.File.OpenRead
Using sr As New IO.StreamReader(fs)
While Not sr.Peek = -1
srsCol.Add(New List(Of String)(sr.ReadLine.Split(","c).ToList))
End While
End Using
End Using
dgStaff.ItemsSource = srsCol
End If
End If
Catch ex As Exception
MessageBox.Show(ex.ToString)
End Try