I am trying to use the .Net class Microsoft.VisualBasic.FileIO.TextFieldParser to read in a csv. The problem I am having is that the value of the variable netArray appears to be being set to a single string, without the values being split to separate array entries. Any idea as to why this would happen?
int counter, xppArrayLength;
str xppValue;
str arr[];
System.String[] netArray;
System.String[] delimeters = new System.String[1]();
Microsoft.VisualBasic.FileIO.TextFieldParser parser = new Microsoft.VisualBasic.FileIO.TextFieldParser(myPath);
delimeters.SetValue(",",0);
parser.set_Delimiters(delimeters);
parser.set_HasFieldsEnclosedInQuotes(true);
netArray = parser.ReadLine();
while(netArray.get_Length())
{
xppArrayLength = netArray.get_Length();
for(counter = 1; counter <= xppArrayLength; counter++)
{
xppValue = netArray.GetValue(counter-1);
arr[counter] = xppValue;
}
netArray = parser.ReadLine();
} }