954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

ComboBox woes

I have 2 issues:rolleyes: :

1. I'm creating a combobox from inside code (sort of dynamic, when the user finishes a row, another row appears) and I would like to know how to set the list of items the user chooses from.

2. How can I block the user from typing custom values into a combobox, but still accept when they select an item from the list?

Thanks;)

scru
Posting Virtuoso
1,629 posts since Feb 2007
Reputation Points: 975
Solved Threads: 140
 
I have 2 issues:rolleyes: : 1. I'm creating a combobox from inside code (sort of dynamic, when the user finishes a row, another row appears) and I would like to know how to set the list of items the user chooses from.



is it possible to see a snippet of what you are doing?

are you stating that if they do something in A then a new combo box is created dynamically on the form at point B and you need to know how to modify it?

but the easiest way to add data to a combo box is by setting the range of items to choose from

_MyComboBox.Items.AddRange( new string[] {
"ITEM 1",
"ITEM 2",
"ITEM 3",
"ITEM 4",
....
"ITEM 10" } );
2. How can I block the user from typing custom values into a combobox, but still accept when they select an item from the list? Thanks;)



change the combobox to a dropdownlist in the dropdownstyle combo box settings and the user cannot enter a string in anymore, just select from the list.

Killer_Typo
Master Poster
781 posts since Apr 2004
Reputation Points: 152
Solved Threads: 39
 

Thanks for answer to question two. I figured out the first one though.

scru
Posting Virtuoso
1,629 posts since Feb 2007
Reputation Points: 975
Solved Threads: 140
 
Thanks for answer to question two. I figured out the first one though.



glad i could help out.

Killer_Typo
Master Poster
781 posts since Apr 2004
Reputation Points: 152
Solved Threads: 39
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You