ComboBox not working properly...need to remove read-only property

stephenlecompte
09-10-2003, 03:42 PM
I have a ComboBox that has the Style set to 2-Dropdown List and I'm very angry with it right now. Cause even tho I can type in a character that would match something on the list, like an a - and the word apple would appear, or b - and the word bear would appear (of course if they were in my list)...I cannot have my ComboBox make it equal to nothing because the property on it is Read-only!

So let's say I start a new order and I have all my text boxes erased with the data...I can't make my combo box cmbList.Text = ""
Any help is appreciated!

Thanks,


Stephen

rahamad
09-10-2003, 03:44 PM
Try setting the ListIndex property to -1

stephenlecompte
09-10-2003, 04:00 PM
Try setting the ListIndex property to -1
How do I set the ListIndex property of a combobox?
I don't see on the right any field except List itself that comes close to that property!

????

rahamad
09-10-2003, 04:04 PM
It can only be done at runtime. So when you clear all your controls, you just say:

Combo1.ListIndex = -1

stephenlecompte
09-10-2003, 04:13 PM
It can only be done at runtime. So when you clear all your controls, you just say:

Combo1.ListIndex = -1

Its working good...my only problem is that when I go ahead and click on the combo box - at the beginning of the list "-1" shows up...and I don't even have that above command in the listing!

Diurnal
09-10-2003, 04:14 PM
Combo1.Clearwill clear all the items in your ComboBox.

rahamad
09-10-2003, 04:18 PM
You didn't accidentally add "-1" to the list property from design mode, did you?

Diurnal
09-10-2003, 04:21 PM
Combo1.Clearwill clear all the items in your ComboBox.
I think I missunderstood.Combo1.Text = "" works for me. It leaves the entry blank but the list is still available.

stephenlecompte
09-10-2003, 04:23 PM
You didn't accidentally add "-1" to the list property from design mode, did you?

Nope- I can't change the List property on the right. It just stays at (List) and its the same as ItemData.

There is nothing in the rest of my properties that comes close to a -1!

I know I did Service Pack 5 on my machine....so I'm hoping that fixed a bug. Maybe I need to reinstall it again?

In the coding the only place I have a -1 is at the

SALES.ListIndex = -1

I have SALES as the name of my combobox.

rahamad
09-10-2003, 04:24 PM
Diurnal - this would work, except that he has the style of his ComboBox set to 2, so you can't change the text property, that's why you have to use the ListIndex property

rahamad
09-10-2003, 04:26 PM
You should be able to click a drop-down arrow next to the list property in design mode. That will drop down a list of default items for your combo box. Check there for the "-1"

stephenlecompte
09-10-2003, 04:32 PM
Diurnal - this would work, except that he has the style of his ComboBox set to 2, so you can't change the text property, that's why you have to use the ListIndex property


What I did was deleted the combo box, made a new one, renamed it with the old name and now it works! Thanks for your help. I appreciate it!

Sincerely

Stephen :chuckle:

Diurnal
09-10-2003, 04:36 PM
Rahamad:
I tried your method and it works great. Did not notice the Style = 2 in the original post. Thanks.

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum