Hi there,

I'm reading the contents of a text document and saving all of the values (csv) into an array. My issue is that the very first article in the document is always being saved with "" appended to the beginning.

eg.

Text document reads:

Hello,Doctor,Name,Continue,Yesterday,Tomorrow

When it is brought into the array:

array(0) = Hello
array(1) = Doctor
array(2) = Name
etc.

As you can see it only affects the first entry.

Here's a code snippet from my project:

FileOpen(1, "quiz.txt", OpenMode.Input)

Do While Not EOF(1)
    numQuestions += 1

    ReDim Preserve questionInfo(numQuestions * 6 - 1)

    For counter As Integer = (numQuestions * 6 - 6) To (numQuestions * 6 - 1)
        Input(1, questionInfo(counter))
    Next
Loop

FileClose(1)

Any help at all is of course greatly appreciated!

Hi,

It looks like you are picking up some sort of formatting code or something. Have you tried opening the file in notepad? Are the characters appearing in the file in Notepad? I've had trouble in the past like this with csv files generated by excel especially if some sort of data sort was applied on it.

What program was used to create the file? Do you have the code that was used?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.