Comma for ComboBox

ugh3012

Member
Joined
Feb 20, 2007
Messages
13
Programming Experience
5-10
Lets say I have a array or a string with comma that I would populate the combo box. I need the combo box to ignore certain comma like in City and state.

How do I get the combo box to ignore certain comma and keep it. Here is a example. The comma after Orlando and Rochester should be treated as a character not as a delimiter. I tied double it with another comma, but that created more rows in the combo box.


sOptions = "Orlando, FL, Rochester, NY, None"

cmb.Items.AddRange(sOptions)
 
You don't get the ComboBox to ignore the comma. This has nothing at all to do with the ComboBox. You need to process the data yourself first and put it in the correct form first, then pass that data to the ComboBox. If you want the ComboBox to display three items - "Orlando, FL", "Rochester, NY" and "None" - then it's up to you to write code to break up that initial String into those substrings, then pass those separate substrings to the ComboBox for display.

Why is that data in that form to begin with? If you can, store the data in a sensible form to begin with and then this issue won't arise. Where is the data coming from and can you get it it in a more sensible form, e.g. line breaks between the items instead of commas or double-quotes around the items containing the commas?
 
Back
Top