CodePaste Logo
New Snippet New Snippet Recent Snippets Recent Snippets My Snippets My Snippets Web Code Search Snippets Search
Sign inor Register
Language: C#

Bind a (DevExpress) ComboBox from a Dictionary

425 Views
Copy Code Show/Hide Line Numbers
enum ReportTypes 
{
   Country, CountryState, CountryStateZone, CountryStatePostCode, CountryZone, CountryStateCounty
}
 
var reportTypes = new Dictionary<int, string> () 
    { 
        {(int)ReportType.Country, "By Country"},
        {(int)ReportType.CountryState, "By Country, State"},
        {(int)ReportType.CountryStateZone, "By Country, State, Zone"},
        {(int)ReportType.CountryStatePostCode, "By Country, State, Postal code"},
        {(int)ReportType.CountryZone, "By Country, Zone"},
        {(int)ReportType.CountryStateCounty, "By Country, State, County"},
    };
 
// Bind to control
cboReportType.Properties.ValueMember = "Key";
cboReportType.Properties.DisplayMember = "Value";
cboReportType.Properties.DataSource = reportTypes.ToList();
by Cat
  June 01, 2010 @ 4:55am
Tags:

Add a comment


Report Abuse
brought to you by:
West Wind Techologies



If you find this site useful and use it frequently please consider making a donation to support this free service.
Donate