Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C# (http://www.programmingforums.org/forum16.html)
-   -   Combo Box (http://www.programmingforums.org/showthread.php?t=11291)

crawforddavid2006 Sep 10th, 2006 9:59 PM

Combo Box
 
I can't figure out how to keep the text in the box from being edited

King Sep 10th, 2006 10:03 PM

Try changing the DropDownStyle property to DropDownList. This can either be done through the designer or via code.

crawforddavid2006 Sep 10th, 2006 10:06 PM

Thanks.

King Sep 10th, 2006 10:30 PM

No problem, I came accoss the same problem a couple months ago

crawforddavid2006 Sep 10th, 2006 11:50 PM

I've searched for this and can't find any help. I am trying to make a text box equal something if a certain item is choosen. I don't know if that makes sense but if it does could you help me?

King Sep 11th, 2006 12:07 AM

Open up your form designer where your combo box is located and double click the combo box and it will create and event. This event will be triggered every time there is a new option selected in the combo box, so now you can put an if statement in that event that checks what has been selected, and then you can set your text box if it meets the right criteria. I think this is what you are looking for, if not please provide a bit more info.

crawforddavid2006 Sep 11th, 2006 12:19 AM

yeah thats what i mean but when i try this if statement
[php]
if(this.Equals("COMPUTERS"))
displaybox.Text = "computers";
[/php]

it does not display in the text box

King Sep 11th, 2006 12:44 AM

Don't go "this.Equals", "this" means the form you are on; use the name of your combobox.

:

if(comboBox.Text == "COMPUTERS")
    displaybox.Text = "computers";


crawforddavid2006 Sep 11th, 2006 1:29 PM

Thanks again

crawforddavid2006 Sep 11th, 2006 1:57 PM

Maybe its just me but finding any info on combo boxes is really hard. I would like to add a text file to combo boxes collection and i can, but it is just one really long line. How can i get it to have a new line for each new line in the text file?


All times are GMT -5. The time now is 1:04 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC