Keep Leading Zeroes In CSV File When Importing To VB.NET
Posted on 2007-07-25
I'm importing a CSV file into VB.NET 2005. I'm storing the CSV file in a dataset, and I want to manipulate that...NOT the original CSV file. This dataset is then being displayed in a DataGridView or a Messagebox.
The CSV file contains a 3-character field that holds numbers with leading zeros. Example: 027, 001, 033. These leading zeros ARE showing when I view the CSV file in Notepad.
The problem is that when I display these values in a Messagebox or DataGridView, it appears that the leading zeros have been dropped. How can I keep these leading zeros when I import the CSV to a dataset for further manipulation?
PS: I AM NOT using an Excel spreadsheet, and I am not manipulating the CSV file directly...just the dataset that stores info. from the CSV. The field in question is called "loc" and it should be 3 characters long, with leading zeros. Example: 027, 033, 001 They are stored correctly in the actual CSV file.