Click here to Skip to main content
15,922,696 members
Home / Discussions / C#
   

C#

 
GeneralRe: WinXP Style Pin
Chris Rickard11-Jul-02 11:46
Chris Rickard11-Jul-02 11:46 
GeneralRe: WinXP Style Pin
Nnamdi Onyeyiri11-Jul-02 23:50
Nnamdi Onyeyiri11-Jul-02 23:50 
GeneralADO Null Referance Pin
Steve Severance11-Jul-02 10:40
Steve Severance11-Jul-02 10:40 
GeneralRe: ADO Null Referance Pin
Philip Fitzsimons11-Jul-02 11:59
Philip Fitzsimons11-Jul-02 11:59 
GeneralRe: ADO Null Referance Pin
Steve Severance12-Jul-02 3:19
Steve Severance12-Jul-02 3:19 
GeneralRe: ADO Null Referance Pin
Nick Parker15-Jul-02 18:15
protectorNick Parker15-Jul-02 18:15 
QuestionAdding a Collection to the Property Browser? Pin
Zombies with Coffee, LLC11-Jul-02 9:48
professionalZombies with Coffee, LLC11-Jul-02 9:48 
AnswerRe: Adding a Collection to the Property Browser? Pin
Zombies with Coffee, LLC11-Jul-02 10:06
professionalZombies with Coffee, LLC11-Jul-02 10:06 
GeneralAnyone like to comment on this, feel free :) Pin
leppie11-Jul-02 9:42
leppie11-Jul-02 9:42 
GeneralRe: Anyone like to comment on this, feel free :) Pin
Rama Krishna Vavilala11-Jul-02 9:49
Rama Krishna Vavilala11-Jul-02 9:49 
GeneralRe: Anyone like to comment on this, feel free :) Pin
leppie11-Jul-02 10:07
leppie11-Jul-02 10:07 
GeneralSystem.WinForms Pin
Nnamdi Onyeyiri11-Jul-02 9:39
Nnamdi Onyeyiri11-Jul-02 9:39 
GeneralRe: System.WinForms Pin
Rama Krishna Vavilala11-Jul-02 9:42
Rama Krishna Vavilala11-Jul-02 9:42 
GeneralRe: System.WinForms Pin
Nnamdi Onyeyiri11-Jul-02 9:44
Nnamdi Onyeyiri11-Jul-02 9:44 
GeneralRe: System.WinForms Pin
Zombies with Coffee, LLC11-Jul-02 9:50
professionalZombies with Coffee, LLC11-Jul-02 9:50 
GeneralRe: System.WinForms Pin
Nnamdi Onyeyiri11-Jul-02 9:56
Nnamdi Onyeyiri11-Jul-02 9:56 
GeneralRe: System.WinForms Pin
leppie12-Jul-02 0:34
leppie12-Jul-02 0:34 
GeneralRe: System.WinForms Pin
Nnamdi Onyeyiri12-Jul-02 0:41
Nnamdi Onyeyiri12-Jul-02 0:41 
GeneralAgain IIS Pin
Mazdak11-Jul-02 5:18
Mazdak11-Jul-02 5:18 
GeneralRe: Again IIS Pin
Richard Deeming11-Jul-02 6:03
mveRichard Deeming11-Jul-02 6:03 
GeneralRe: Again IIS Pin
Mazdak11-Jul-02 9:29
Mazdak11-Jul-02 9:29 
GeneralListing Local Users Pin
Ben Swann11-Jul-02 4:29
Ben Swann11-Jul-02 4:29 
GeneralRe: Listing Local Users Pin
Richard Deeming11-Jul-02 5:44
mveRichard Deeming11-Jul-02 5:44 
GeneralRe: Listing Local Users Pin
Philip Fitzsimons11-Jul-02 12:00
Philip Fitzsimons11-Jul-02 12:00 
GeneralProblem with ComboBox.SelectedValue Pin
leppie11-Jul-02 3:57
leppie11-Jul-02 3:57 
Hi all,

ComboBox.SelectedValue dont seem to work correctly. Code:

... 
void SetupCustomers(){ //called from form constructor
cbCust.DataSource = dbase.GetCustomers(); //returns Customer[] from database
cbCust.DisplayMember = "Name"; // The name property
cbCust.ValueMember = "ID"; // The ID property (PK in database)
}
...


However when calling cbCust.SelectedValue returns the wrong value. Calling ((Customer)cbCust.SelectedItem).ID gives the correct answer.

This seems to be a problem with the DisplayMember being (automatically) sorted as all the returned SelectedValue's are within range.

EG : Customers[] expanded may look like this:

ID(Value) Name(Display)
20 Ben
21 John
23 Ann
26 Frank
27 Arnold

The combobox will display the Displaymembers in alphebetical order. Here is where the problem lies (i think Smile | :) ):

Value Display
20 Ann
21 Arnold
23 Ben
26 Frank
27 John

Now this is how Mr. ComboBox display and intepret Value and Display members, thus getting the mappings all wrong.

If anyone has had a similar experience or can spot where I made a mistake, please tell me Smile | :)

Thanking all replies in advance

Cheers Smile | :)

READ MSDN

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.