troubleshooting Question

DataSource ListBox from Linq

Avatar of Philippe Renaud
Philippe RenaudFlag for Canada asked on
.NET ProgrammingC#Visual Basic.NET
5 Comments1 Solution660 ViewsLast Modified:
Hello EE,

I have a dictionnary with KeyValuePair of integer, String.

Lets say it has:   1, "Test"    2 , "Hello    3, "Sunny"

I need to fill a ListBox that has ValueMember =  "ID  and DisplayMember = "Description"

the DataSource needs to come from the Dictionnary but since I cannot Alias a dictionnary columns, I used LINQ in this way :

                Dim q = _
                    From m In dict
                    Select ID = m.Key _
                         , DEscription = m.Value

but when I do   myLsitBox.DataSource = q

I have error...

can you help ?
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros