Controlling Too Many listboxes ( C#)
- by Ases
I have almost 200 listboxes. I'm changing their visibility according to my variables from database.
So I thought that, I prepared a arraylist. like this
ListBox[] lbs = this.Controls.OfType<ListBox>().ToArray();
And used like this.
for (int idx = 0; idx < Convert.ToInt32(ds.Tables[j].Rows[i][2])*12; idx++)
lbs[idx].Visible = true;
This codes are written to comboboxchange. Now everything is okay. But;
example;
first time I changed combobox
1-20 listboxes visible=true
I changed combobox again
not 1-20. 20,40 changing :S How can it be, can u tell me an alternative array list type, or another way?