CSVReader is a simple, lightweight open source C# class library to read CSV data from text files and strings. To use it, simply download the latest version and add it to your project, either as a compiled DLL (it will build in any version of Visual Studio 2008) or as source.
Download: CSVReader source v1.0.0
If you want to include CSVReader directly in your source code, just download CSVReader.cs and StringConverter.cs and add them to your C# project.
CSVReader.csproj. Add it to the project.dataGridView1 and that its Dock property is set to Fill.using Com.StellmanGreene.CSVReader; to the top of the form code in Form1.cs.
public Form1()
{
InitializeComponent();
OpenFileDialog dialog = new OpenFileDialog();
dialog.Filter = "CSV Files (*.csv)|*.csv";
if (dialog.ShowDialog() == DialogResult.OK)
{
DataTable table = CSVReader.ReadCSVFile(dialog.FileName, true);
dataGridView1.DataSource = table;
}
}
This source code is released under the BSD License.