sorry to bother, but I have a problem with C# Winforms, since I've been searching for the same problem, I found some solutions but they're not working for me. OK, I have a Bindinglist with objects
BindingList<objects.usuario> usuarios = new BindingList<objects.usuario>();
The objects have some public strings and int variables, one string and one int are the variables that I need.
public string dataNombreCompleto;
public int dataIdUsuario;
So, once the list "usuarios" has some objects, I do this
cbAdministrativos.DisplayMember = "dataNombre";
cbAdministrativos.ValueMember = "dataIdUsuario";
cbAdministrativos.DataSource = usuarios;
And the thing is, it's not working, the combobox (cbAdministrativos) still displays the object.
When I go through the debugger, after a breakpoint, the combobox sets the display member, the valuemember and the datasource, as the code goes, but, in the next instruction (the end of the method), I realized that the displaymember, magically, turns to "" instead the string "dataNombre".
Any idea?
Thanks in advance, and sorry about the bad english.
SORRY AND THANKS TO ALL! In my desperation, I tried with different fields in the object, and I didn't realize that I left "dataNombre" instead of "dataNombreCompleto" for the example code in the question, anyway that's correct, that's the original DisplayMember in my original code, but, the problem's still there :(