Hi,
I need a little help with listboxes. I have created a listbox in WPF, and added items with the listbox1.items.Add(...) method from the c# code. The items appear alright, but I can't select them one-by-one, selection is all messed up. Seems that these items have the same index. How can I get listbox.items.add to work correctly?
Thank you in advance
V
Loading
Viktor PPosted Mar 28, 2009, 10:51 AM
Thanks, anyways!
amit ramdeoPosted Mar 28, 2009, 2:40 AM
hi there ..
i is happening as you are trying to add the same object again and again.
just try to add different one to the list box like
decalre one variable i and increment in each click. then add the variable along with the name and check
i++;
listBox1.Items.Add("Amit"+i);
Viktor PPosted Mar 27, 2009, 6:37 PM
I've also found that all the items added from c# have the same index property.
StefanPosted Mar 27, 2009, 6:12 PM
Viktor PPosted Mar 27, 2009, 6:00 PM
{
listBox1.Items.Add("item")
}
I press the button several times, and then try to select the items.
StefanPosted Mar 27, 2009, 5:54 PM