Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

use Dictionary<String,String> as datasource for ListBox?

Status
Not open for further replies.

jrenae

Programmer
Jan 18, 2006
142
US
Hello,

I'm trying to use a generic Dictionary<String,String> as the datasource for my ListBox. I can bind to it without error but I see both the value and the key in the DataTextField.

Is it possible to define the Dictionary.Value as the ListBox.DataValueField?

It's not seeming that way to me, but thought I'd throw this out there.

Thanks
 
I would not use a generic dictionary. I would use a simple POCO instead with a value and text property. then bind the listbox values to the value property and text to the text property.

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top