ComboBox woes

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Feb 2007
Posts: 1,606
Reputation: scru has a spectacular aura about scru has a spectacular aura about 
Solved Threads: 130
Featured Poster
scru's Avatar
scru scru is offline Offline
Posting Virtuoso

ComboBox woes

 
0
  #1
Mar 17th, 2007
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
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 759
Reputation: Killer_Typo will become famous soon enough Killer_Typo will become famous soon enough 
Solved Threads: 35
Killer_Typo's Avatar
Killer_Typo Killer_Typo is offline Offline
Master Poster

Re: ComboBox woes

 
0
  #2
Mar 20th, 2007
Originally Posted by scru View Post
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

  1. _MyComboBox.Items.AddRange( new string[] {
  2. "ITEM 1",
  3. "ITEM 2",
  4. "ITEM 3",
  5. "ITEM 4",
  6. ....
  7. "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.
Dont forget to spread the reputation to those that deserve!
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 1,606
Reputation: scru has a spectacular aura about scru has a spectacular aura about 
Solved Threads: 130
Featured Poster
scru's Avatar
scru scru is offline Offline
Posting Virtuoso

Re: ComboBox woes

 
0
  #3
Mar 20th, 2007
Thanks for answer to question two. I figured out the first one though.
Reply With Quote Quick reply to this message  
Join Date: Apr 2004
Posts: 759
Reputation: Killer_Typo will become famous soon enough Killer_Typo will become famous soon enough 
Solved Threads: 35
Killer_Typo's Avatar
Killer_Typo Killer_Typo is offline Offline
Master Poster

Re: ComboBox woes

 
0
  #4
Mar 20th, 2007
Originally Posted by scru View Post
Thanks for answer to question two. I figured out the first one though.
glad i could help out.
Dont forget to spread the reputation to those that deserve!
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC