-4

I want to read data from a text file and show in a table (much like the DataGrid / DataGridView classes). The txt file must be local and not sql based (like the mentioned classes).

Doing this in C# windows form.

Any ideas?

If you have any questions I will edit this question as needed.

EDIT:

This seems to work:

this.DataGridView1.Rows(1).Cells(1).Value = stringReader;
Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
maffo
  • 1,393
  • 4
  • 18
  • 35
  • 3
    Did you try something yourself first? – Arief Nov 28 '11 at 09:59
  • 1
    I'm tempted to downvote this question because you provided inadequate detail for anyone to provide any real, pertinant, accurate advice... You mentioned editing the question... Don't wait to be asked... just go ahead provide enough detail... better still, show us what you've tried. – corlettk Nov 28 '11 at 10:03
  • I have found this: http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/thread/3c545964-6443-4771-b5dc-d31f0e0cdac2 – maffo Nov 28 '11 at 10:04

1 Answers1

2

Open up a filestream and parse your values into a DataTable... then set your grid's datasource to the datatable. Try that out and update if you have any problems :)

Nathan
  • 6,095
  • 2
  • 35
  • 61