Click here to Skip to main content
16,010,544 members
Home / Discussions / C#
   

C#

 
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 
GeneralRe: Problem with ComboBox.SelectedValue Pin
Chris Rickard11-Jul-02 8:54
Chris Rickard11-Jul-02 8:54 
GeneralRe: Problem with ComboBox.SelectedValue Pin
leppie11-Jul-02 9:29
leppie11-Jul-02 9:29 
GeneralRe: Problem with ComboBox.SelectedValue Pin
Chris Rickard11-Jul-02 10:16
Chris Rickard11-Jul-02 10:16 
I was able to reproduce the behavior doing to following:

I made a class: test with properties Name and Id.
Set the ComboBox's DataSource to a test[] With Name as DisplayMember and Id as ValueMember
Set Sorted=true

Noting that I had to set sort before setting the DataSource property otherwise it will throw an exception.

In thinking about it the behavior makes sense that it could happen this way. When you set the DataSource of a ComboBox it copies the list to its own internal list.

Text returns the item in the internal list. SelectedValue uses a combiniation of CurrenctManager ,SelectedIndex and ValueMember to retrieve an Item from the datasource. SelectedItem is probably a pointer stored in the internal list that gets Sorted with Text.

Anyways Sorting your DataSource (via Array.Sort, ArrayList.Sort, DataTable.DefaultView.Sort; whatever the type of DataSource you have) should fix the problem. Even if the
Sorted property inadvertantly gets set on the combobox, there's no mismatch between your datasource and its internal list because its already sorted.Smile | :)
GeneralRe: Problem with ComboBox.SelectedValue Pin
leppie11-Jul-02 10:46
leppie11-Jul-02 10:46 
GeneralSub-bitmap from bitmap Pin
Oyvind Bratland11-Jul-02 3:15
Oyvind Bratland11-Jul-02 3:15 
GeneralRe: Sub-bitmap from bitmap Pin
James T. Johnson11-Jul-02 19:08
James T. Johnson11-Jul-02 19:08 
GeneralRe: Sub-bitmap from bitmap Pin
Oyvind Bratland11-Jul-02 21:24
Oyvind Bratland11-Jul-02 21:24 
QuestionTreeView? Pin
Member 1697711-Jul-02 2:39
Member 1697711-Jul-02 2:39 
AnswerRe: TreeView? Pin
Oyvind Bratland11-Jul-02 2:48
Oyvind Bratland11-Jul-02 2:48 
GeneralRe: TreeView? Pin
Member 1697711-Jul-02 4:21
Member 1697711-Jul-02 4:21 
GeneralRe: TreeView? Pin
Eric Gunnerson (msft)11-Jul-02 7:17
Eric Gunnerson (msft)11-Jul-02 7:17 
Generalgetting the length of a closed MemoryStream Pin
shaunw11-Jul-02 1:21
shaunw11-Jul-02 1:21 
GeneralRe: getting the length of a closed MemoryStream Pin
Nish Nishant11-Jul-02 1:31
sitebuilderNish Nishant11-Jul-02 1:31 
GeneralRe: getting the length of a closed MemoryStream Pin
shaunw11-Jul-02 2:12
shaunw11-Jul-02 2:12 
GeneralIIS Pin
Mazdak10-Jul-02 20:53
Mazdak10-Jul-02 20:53 
GeneralRe: IIS Pin
James T. Johnson10-Jul-02 21:17
James T. Johnson10-Jul-02 21:17 
GeneralRe: IIS Pin
Mazdak10-Jul-02 22:16
Mazdak10-Jul-02 22:16 
GeneralRe: IIS Pin
Richard Deeming10-Jul-02 23:43
mveRichard Deeming10-Jul-02 23:43 
GeneralRe: IIS Pin
Mazdak11-Jul-02 5:20
Mazdak11-Jul-02 5:20 
GeneralRe: IIS Pin
Richard Deeming11-Jul-02 5:43
mveRichard Deeming11-Jul-02 5:43 

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.