HI guys i'm trying to load the contents of my file "item.ids" which currently holds this:
1:Stone
2:Grass
3:Dirt
I want to read each line the the file and split it at the ":". I am using the following code:
foreach(String line in File.ReadAllLines("item.ids")) {
items = line.Split(':');
}
foreach (String part in items)
{
addToList(specs, part);
}
}
public void addToArray(Array array, int index, String s)
{
try
{
array.SetValue(s, index);
}
catch (Exception ex)
{
addToList(specs, ex.ToString());
}
}
public void addToList(ListBox listbox, String s)
{
listbox.Items.Add(s);
}
This works but it only does the last line so it will output it like so:
3
dirt
If you could help me along with my code it would be very helpful.