Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit when adding items to Listbox : Value does not fall within the expected range.
1 replies. Latest Post by Jonathan Shen – MSFT on June 26, 2009.
(0)
elord
Member
0 points
1 Posts
06-22-2009 7:47 AM |
i'm trying to add some items to list box.
it was working before ,i made some changes and it's not working now ,
I'm receiving a list of objects from web service (e.Result)
on the Add method i'm geting the exception:
Value does not fall within the expected range.
DbFieldName is a String
fields = e.Result; foreach (var item in fields) { ListBoxItem itemL = new ListBoxItem(); itemL.Content = item.DbFieldName; FieldsList.Items.Add(itemL); }
Jonathan...
All-Star
24969 points
2,434 Posts
06-26-2009 4:09 AM |
Hi Elord,
Based on your description, we recommend you add breakpoint to the begining of the method or fields = e.Result; Please make sure e.Result is a collection. If not, you'd better add breakpoints to your WebService to get the details. By the way, you'd better first clear the ListBoxItems before you add new items if they are needs to be replaced. Please let me know the results.
Best regards,
Jonathan