|
-
Sep 7th, 2011, 05:02 PM
#1
Thread Starter
New Member
Reading/writing 2d string array from/to file
I can write a 1-d string array to file with:
Dim test() As String = {1, 2, 3, 4, 5}
File.WriteAllLines("C:\MyFile.txt", test)
but can't see how to write a 2-d array to file.
I've tried this:
Dim test(,) As String = {{1, 2, 3, 4, 5}, {34, 22, 12, 33, 55}}
Dim myfile = File.CreateText("C:\MyFile.txt")
Dim row, col As Integer
For row = 0 To 1
For col = 0 To 4
myfile.WriteLine(test(row, col))
Next
Next
which produces a file of 0 bytes.
What should I be doing?
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
|