Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21842

Simple 2d Array question

$
0
0
Sorry I know I am new and this question has probably been asked because I have seen similar threads but still I have a simple task but I just cant get it to work even looking at those.

I have a txt file that looks like

item,item,item,item,item
item,item2,item,item,item
item,item,item,item,item
item,item,item,item,item
item,item,item,item,item
item,item,item,item,item
item,item,item,item,item

and i want to get it into a 2d array that would let me type array(2,2) would give me the item 2

so i have my file loaded by lines using

Dim file() As String = IO.File.ReadAllLines("file.txt")

and i want to get the basic result of doing this

dim array = file(0).Split(","c)
dim array2 = file(1).Split(","c)
dim array3 = file(2).Split(","c)
dim array4 = file(3).Split(","c)
dim array5 = file(4).Split(","c)
dim array6 = file(5).Split(","c)
dim array7 = file(6).Split(","c)

but obviously having instead of a bunch of singles just have one 2d array for that

Viewing all articles
Browse latest Browse all 21842

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>