Skip to main content Skip to footer

How to create user-friendly values in dropdown of combobox in WinForms

Issue:

Spread supports displaying a drop-down list and allowing the user to choose items from the list. However, sometimes the drop-down values can be technical and difficult for the user to choose.

 For example, selecting a value from a drop-down containing country codes can be difficult as not every user will remember country codes for each country. Here, a better option would be to display country name itself in the drop-down list but store their codes in the cell.

 Therefore, this article shows how to show user-friendly values in dropdown of combo box cell.

Resolution:

  1. To show user-friendly values in drop-down list, create a ListBox control and populate it with user-friendly values.

  2. Then, assign the created ListBox control to ListControl property of ComboBoxCellType.

Following is the complete code for displaying user-friendly values in drop-down list of combobox cell:


With the above code, the drop-down list of combo box cell will show country names and the combo box cell will show country code, as illustrated in following image:

Tags:

Ruchir Agarwal