I'm making a program which is going to read from a text file which contains this data required to draw a flag when the name of the country is selected from a list box.
Can anyone shed some light on the logic of how I would go abouts doing it?
This is what I have so far:
It's obviously incomplete. I can't work out how I would go abouts writing this array. I can get get the first set of information (color etc..) but how would I go abouts getting the next lot?
The flags will be drawn with DrawRectangle[].Indonesia;horizontal,red,60,0
Ireland;vertical,green,80,0;vertical,orange,80,160
Benin;horizontal,yellow,60,0;horizontal,red,60,60;vertical,green,80,0
Can anyone shed some light on the logic of how I would go abouts doing it?
This is what I have so far:
VB.NET:
Structure flagStruct
Dim flagName As String
Dim flagColour As String
Dim flagDirection As String
Dim flagHorizontal As Integer
Dim flagVertical As Integer
End Structure
Dim Flags(MaxFlags) As flagStruct
Private Sub readFlag()
Dim oneFlag As String
Dim FlagFields() As String
Dim sr As IO.StreamReader
sr = IO.File.OpenText("flags.txt")
numFlags = 0
oneFlag = sr.ReadLine
Do While oneFlag <> Nothing
FlagFields = oneFlag.Split(";")
Flags(numFlags).flagName = FlagFields(0)
Do While oneFlag <> Nothing
FlagFields = oneFlag.Split(",")
Flags(numFlags).flagDirection = FlagFields(1)
Flags(numFlags).flagHorizontal = FlagFields(2)
Flags(numFlags).flagVertical = FlagFields(3)
Loop
numFlags = numFlags + 1
oneFlag = sr.ReadLine
Loop
sr.Close()
It's obviously incomplete. I can't work out how I would go abouts writing this array. I can get get the first set of information (color etc..) but how would I go abouts getting the next lot?
Last edited: