Best Way to Read .csv File?

  • Thread starter Thread starter TC
  • Start date Start date
T

TC

Hey All,

I have to read .csv files and display them in a DataGridView.

Currently, I'm dumping the data into a DataTable but it's causing problems
because the engine is automatically converting / deleting material.

I cannot use a .ini file because the .csv files could be called anything and
come from any folder (i.e. it's a 'FileOpen' dialog necessity).

What is the best / quickest way to read .csv files such that the data is not
changed or is understood as strings?

Thanks,

TC
 
Hey All,

It appears that one has to read the file using StreamReader, parse the lines
using the appropriate delimeter and then pump in the columns and rows.

The above worked for me.
 
Not the general best way.

As your CSV file is showable in Excel the you would be able to make dataset
from it (there is a property to distinct numbers from text).

Just for others thinking that what you have choosen is in general the best
way.
(Probably I had done it in your situation the same as you)

Cor
 
Back
Top