Re: Advise on best way to do this.
Maybe an ArrayList of textbox's ugh, this seems like a weird way of doing this.
Re: Advise on best way to do this.
This looks ugly to me. Change the number of controls dinamically... :sick: What someone creates 10 or 20 user levels? It's probably unlikely, bu what if? Will you have space for all?
I would suggest a list box, or perhaps a checked list box. You can add or remove any items to/from it without woring for problems with form space.
Just my 2 cents.
Re: Advise on best way to do this.
Ok so a list/combo is better.
So let them enter stuff in and then just go thru the collection parsing out the differences?
Re: Advise on best way to do this.
Ok so like this?
Code:
//reading
//Determine # of positions
Int32 positions = config.Read("numPositions");
for (Int32 index = 1; index <= positions; index++)
{
//positions would be listed as position1, position2, position3, position4 etc
this.lstBoxPositions.Items.Add(config.Read("position" + index)); }
then for writing
Code:
//this doesnt work as listBox has no length property or no easy way of //finding out how many entries are in it
config.Write("numPositions", this.lstBoxPositions.length);
for (Int32 index = 0; index <= this.lstBoxPositions.length; index++)
{
config.Write("position" + (index + 1), this.lstBoxPositions.Items[index].ToString());
}
Only problem with this I can see is that if they had 10 and erased 5, 5 would still be in the xml file, just wouldnt be used. I guess I could just
Code:
for (Int32 index = lstBoxPositions.Length(); index < oldLength; index++)
{
config.Write("position" + (index + 1), "");
}
this way the lines would still be there but the text would be gone. Would have to figure out a way to erase the lines in the xml files otherwise.
if anyone can think of a cleaner way to do this, let me know thanks.
Re: Advise on best way to do this.
ok figured out num of items in listbox.
this.lstBoxPositions.Items.Count