Why?

mmb

Active member
Joined
Aug 1, 2004
Messages
42
Programming Experience
1-3
Why should one use DisplayMember...

Why should one use DisplayMember and ValueMember property of a LISTBOX to veiw ValueMember in a (say) Textbox1, RATHER then simply binding the Textbox1 with that Particulare column that has been assign to the Listbox ValueMember Property ?

Any satifying answer pls ....

If there is any other significant use of DisplayMember and ValueMember property of a LISTBOX pls let me know.

Thank you
 
Last edited by a moderator:
once you set the source you use the display member for the feild you want displayed in the combobox/listbox and the valuemember is a "hidden" feild that's also access when you code the SelectedIndexChanged event.

example:
Source = EmployeeTable
DisplayMember = Employee Name
ValueMember = Employee ID

now when you select the employee name you use the empID to bring up his/her employment record...

now in your example it is indeed "stupid" to use the value member (in my opinion) but with programming, the code is yours so you can accomplish the task anyway ya want (that works of course ;) )
 
Back
Top