Question Read CSV file into array > sort/add/edit/delete and write back to CSV

SimoHDK

New member
Joined
May 17, 2011
Messages
1
Programming Experience
Beginner
Hey All,


Got a project coming up and I've got no idea how to start it.


The gist of the program is to:


- Read a CSV file into an array
- Get this visible in a list box, so the values can be:
- Sorted
- Edited
- Deleted
- Added
- Finally save these manipulated values back to the text file


Would love some suggestions and code as to how to get this going, hopefully I'll get the hang of it and come back and fourth for help :)
 
I doubt that you'd use a ListBox if the file contains multiple columns. A DataGridView is the obvious choice because it inherently supports all those operations.

1. Read the file into a DataTable, either using ADO.NET or a TextFieldParser.
2. Bind the DataTable to the DataGridView.
3. The user can add, edit, delete and sort.
4. Write out the contents of the DataTable to a file using nested For or For Each loops and a StreamWriter.
 
Back
Top