PDA

Click to See Complete Forum and Search --> : Iterate members of a structure(possible ?)


masteripper
Apr 29th, 2009, 05:42 AM
Well i am trying to find if this is possible
I am trying to make a config file for my WM application and i have this idea but i don't know if this is doable.
Well lets describe it
I want to pass some variables to a function that will be read from a configuration file
I am thinking it a nice programming technique to organize this variables to a structure
So far everything is good
Now the question is how to iterate these structure variables
Example
Structure MyStructure
Dim Var1 as string
Dim Var2 as string
Dim Var3 as boolean
end structure

the config file will have this formulation: (always)
Var1:test1
Var2:test2
Var3:True

So when i read this config file i want something like this
-------------------------
index = 0
Do
line = sr.ReadLine()
mystructure(index) =split(line,":")(1) < ---- Something like that that will not force me to write everything everytime but loop through the members of the structure
index = index +1
Loop Until line Is Nothing
----------------------------

Thanks in advance
Any idea that will help me implements this more than welcomed

Lightning
May 6th, 2009, 08:51 AM
If you want something to do that you have 2 options:
Write a function that does this
Use a class