Reputation: 366
Friends, I have a requirement i am given a text file with fixed no. of columns but row varies, i should read that and populate that in grid/table using Silverlight The text file will have data something like this
0, 0, 2, 1, "url1", description1 1, 0, 2, 2, "url2", description2 1, 1, 4, 2, "url3", description2
as we can see columns are fixed but row can vary
Now i want my silverlight app to read this file from system and populate in grid/table like
RowNo ColumnNo Width Height ImageURL Description 0 0 2 1 url1 Description1 1 0 2 2 url2 Description2 1 1 4 2 url3 Description3
I tried reading file using Streamreader but its showing SecurityException error 'SecurityExceptionHandler was unhandled by user code File operation not permitted. Access to path 'c:\path\file.txt' is denied.
Hope my question is clear
Please help me out Thanks in advance.
Upvotes: 0
Views: 125
Reputation: 23515
Show an OpenFileDialog and create a StreamReader from it. Use StreamReader.ReadLine() to read it line by line. String.Split(',') to get the columns or use a more sophisticated regex if the columns can contain commas within their quotes.
That's as far as I can help you. Haven't used DataGrid, but the MSDN docs for it look unusually detailed and its interface very simple.
Upvotes: 1