1. Computing

Chapter 12 - Text Files and String Processing

From , former About.com Guide

8 of 10

Exploring Text Files and String Processing - CSV Files
Simple Excel and Save Option

Simple Excel and Save Option

Another topic that deserves to be in this chapter is a use of strings that goes back to the earliest use of computers and is still going strong today: CSV or Comma Separated Value files. This always creates a lot of questions, especially from people who have used other programming languages or earlier versions of VB because they remember how easy and simple it was and they want to keep it that way. They're in luck! It's still easy and simple.

Back in the "bad ol' days", one of the most common ways to pass information from one program to another was the CSV file. It was simple, straightforward, and just about every program around supported it. It did the job that XML does today before there was any XML. Because this is such a simple and effective method, it's still well supported by VB.NET. To show you how this works, however, let's start at a different point: Excel 2003.

An example of a spreadsheet in Excel is shown above where only three cells have values to keep things simple.

Excel supports CSV files directly, so you can simply save this spreadsheet as a CSV file to get the test file that we need for our example. To continue to keep things simple, save it in the BIN directory of your VB.NET application. That way, we can read it again without specifying a path for the file in the program code.

©2013 About.com. All rights reserved.