Quantcast
Channel: Windows Forms General forum
Viewing all articles
Browse latest Browse all 12583

Loading Long text File into array?

$
0
0

Ok Arrays are confusing me. The code below works perfectly UNTIL the file gets long. That is the part that I dont understand..why would it work with only 10 or so lines of text in the file, but not if 200 lines.

File format example is

Name Abbreviation

Name2 Abbreviation2

My array Dim Countries(250) as Country should be plenty long enough. What am I missing in this section of code..or how could I improve it. Ive read a number of examples to get me to this point. 

Dim Names as string

Dim abbreviations as string

 Dim List() = IO.File.ReadAllLines("Country.txt")
        Dim x = List.Count - 1
        ReDim Countries(x)
        Dim Line As String
        Dim Data() As String
        For i As Integer = 0 To x
            Line = List(i)
            Data = Line.Split(" "c)
            Countries(i).Abbreviation = Data(0)
            Countries(i).Names = Data(1)

        Next

Viewing all articles
Browse latest Browse all 12583

Trending Articles



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