I
I
iluxa18102016-02-23 01:24:08
Programming
iluxa1810, 2016-02-23 01:24:08

Is it possible to add additional information to the ComboBox?

I am populating a ComboBox from a List which contains an ID and a Name.
Is it possible to make the ComboBox at a certain index return not only the Name, but also the real ID ?
In other words, ID and Name were located at a certain ComboBox index, and Name was displayed on the form itself.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey, 2016-02-23
@k1lex

For WinForms:
Install put your table on the DataSourse of the ComboBox. Then set the ValueMember field to the ID field and the DisplayMember field to your Name field.
Here you can see the information just on your question and on List and ComboBox
metanit.com/sharp/windowsforms/4.8.php
If you use WPF, then there is almost the same

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question