Windows Develop Bookmark and Share   
 index > Windows Forms General > Combobox problems with similar items in list.
 

Combobox problems with similar items in list.

Hy.

I've created a form and on it i have a combobox (with the "dropdown" type) with items that are similar to each other, for example :

"test", "Test", "TEST"

Now, when i run the application and i have "TEST" selected in the combobox, when i press the button to show the dropdown list of the combobox it will always show "test" as selected. If i select from the combo "TEST" and reopen the list it will always show "test".

From what i can see, the listbox attached to the combobox selects the items with a case insensitive method.

How can i make the combobox select the correct value when the dropdown list is shown?


P.S. i've tried this on C# and C++/CLI and both do the same thing.

P.S.2 Here's the sample (the combobox initialisation part) that i was trying :


this.comboBox1=newSystem.Windows.Forms.ComboBox();

this.SuspendLayout();

//
//comboBox1
//
this.comboBox1.FormattingEnabled=true;
this.comboBox1.Items.AddRange(newobject[]{
"sometext",
"test",
"TeSt",
"TEST",
"teST",
"anothertext"});
this.comboBox1.Location=newSystem.Drawing.Point(109,37);
this.comboBox1.Name="comboBox1";
this.comboBox1.Size=newSystem.Drawing.Size(121,21);

this.comboBox1.TabIndex = 0;

AlbuEmil  Monday, February 16, 2009 1:43 PM
I'd have to recommend you re-run this test with *real* data in the ComboBox. A user can never figure out whether she needs to select "test" or "TeSt". Clearly, neither can CB. This is not a problem that needs to be fixed.
Hans Passant.
nobugz  Monday, February 16, 2009 1:59 PM
I'd have to recommend you re-run this test with *real* data in the ComboBox. A user can never figure out whether she needs to select "test" or "TeSt". Clearly, neither can CB. This is not a problem that needs to be fixed.
Hans Passant.
nobugz  Monday, February 16, 2009 1:59 PM

This wasn't exactly the answer i was hoping for but you've got a point that the user cannot distinguish between "TEST" and "test" so it's actually a "garbage in garbage out" situation.


The only strange thing that i saw was that if the combobox is set to be of "dropdownlist" type then it works correctly with the same values.

AlbuEmil  Thursday, February 19, 2009 4:34 PM

You can use google to search for other answers

Custom Search

More Threads

• DateTimePicker _ValueChanged event.
• Vertical Positioning in a RichTextBox
• "mirror" picture in form
• How to get the MainForm reference?
• accessing listbox from other class
• disable treeview key pressed text search
• How can i pass values to a precompiled 3rd party app ?
• What about ListView Please help me ??????
• TreeView Drag N Drop
• Newbie Closing Forms