-
Dec 3rd, 2020, 05:14 AM
#1
Thread Starter
New Member
Visual Basic StreamReader - Importing a csv file into an array
Hi all
I have a set of data in csv format, numbers only. It is 2 columns x 111 (varying length) array. It will always be 2 columns.
I am struggling to get the data into an array to manipulate it further.
Can anyone help how I can get the 2 column csv file into a double array?
I have got it working into a textbox using txt.Text = StreamToDisplay.ReadToEnd, but struggling with getting it into an array
Thanks
-
Dec 3rd, 2020, 07:21 AM
#2
Re: Visual Basic StreamReader - Importing a csv file into an array
Start by calling Fiile.ReadAllLines. That will read the lines of the file into a 1D array. That will tell you how many "rows" you need in your 2D array so that you can create it. You can then use a For loop to access each line, split it and populate the corresponding "row" of the 2D array with the numeriic values. No, I'm not going to write an "example" for you. Follow the instructions as best you can and then, if you encounter a specific issue along the way, ask about that specifically.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|