I don't understand how I can retrieve data from a csv file and load it into a text box (I am working in visual basic 2010 express). I also would like to know how to load specific parts of the csv file into the textbox, such as the data contained in column 1, row 5. I am very new with this and I'm sorry if it's simple/easy/not explained well.
1 Answers
You have not demonstrated what you have tried, and I am not going to write a code example. However, the following pseudo code will give you more than enough hints to start coding. I am also assuming that your CSV is well structured and correct.
OPEN the file so you can READ from it.
READ a line
SPLIT the line
extract the required data from the ARRAY and work with it
Repeat until you have read to the END OF FILE or any other condition you need in your code.
Depending on how your CSV is structured, you may be able to read the first line as your field names, in which case you can build an internal structure for additional error checking.
Depending on what you want to do, you can either read each line and then work with the data (e.g. insert it into a text box in a form) or read every line in the file and then work with the total data.
Importantly, at every step think about what could go wrong (e.g. what if you went to open the file, but the file did not exist or open properly) and build in error checking to deal with it.

- 2,400
- 2
- 12
- 22