Created
February 15, 2012 14:39
-
-
Save ChrisMoney/133647d1e2f2de49bb10 to your computer and use it in GitHub Desktop.
C# --Opens CSV file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Open CSV file: | |
1. public Form1() | |
2. { | |
3. InitializeComponent(); | |
4. | |
5. OpenFileDialog dialog = new OpenFileDialog(); | |
6. dialog.Filter = "CSV Files (*.csv)|*.csv"; | |
7. if (dialog.ShowDialog() == DialogResult.OK) | |
8. { | |
9. DataTable table = CSVReader.ReadCSVFile(dialog.FileName, true); | |
10. dataGridView1.DataSource = table; | |
11. } | |
12. } | |
Here is an example of a CSV(Comma Separated Value) file: | |
"REVIEW_DATE","AUTHOR","ISBN","DISCOUNTED_PRICE" | |
"1985/01/21","Douglas Adams",0345391802,5.95 | |
"1990/01/12","Douglas Hofstadter",0465026567,9.95 | |
"1998/07/15","Timothy ""The Parser"" Campbell",0968411304,18.99 | |
"1999/12/03","Richard Friedman",0060630353,5.95 | |
"2001/09/19","Karen Armstrong",0345384563,9.95 | |
"2002/06/23","David Jones",0198504691,9.95 | |
"2002/06/23","Julian Jaynes",0618057072,12.50 | |
"2003/09/30","Scott Adams",0740721909,4.95 | |
"2004/10/04","Benjamin Radcliff",0804818088,4.95 | |
"2004/10/04","Randel Helms",0879755725,4.50 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment