views:

13

answers:

1

I have a combobox in vs 2010 using vb.net. What i'd like to do is use a ilist to drive a combobox. I have this working but when i try to order the combobox using a lambda expression, nothing shows up in the combobox.

  With Me.cbAgency
        .DataSource = Os.OrderBy(Function(o) o.Agency)
        .DisplayMember = "Agency"
        .Tag = Os
        .SelectedIndex = Nothing
    End With

Take out the OrderBy(Function(o) o.Agency) and it works. I've used this syntax before in asp.net and it seems to work.. just wondering what is different or what i've done wrong. Thanks

+1  A: 

You might have to call ToList() on the IQueryable to execute the query:

.DataSource = Os.OrderBy(Function(o) o.Agency).ToList()
Femaref
That worked.. Thank you for the help
jvcoach23