Sorry have seen an error:
If the text of the combo is like the text displayed in the textbox-portion of the combo ComboBox1.Listindex=-1 will be FALSE !!
Main Topics
Browse All TopicsHi everyone!
I have 3 questions for you concerning comboboxes:
1.) How could I FIX the combobox in such a way that one could only choose an element in the list without writing any text and stuff - that is, only pick an entry with no choice of input text or modifying?
2.) When adding a new text as an element of the combobox, how could I check if it's already there and in this case just not add it? It would be silly having 2 similar entries to choose from, wouldn't it?
3.) How can I receive the number of elements within the combobox? I need this in order to output a msgbox, saying that the combobox is empty and in this way disabling it.
Thanks for your immediate answers!
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Hi Luchko
The answers to your questions are as follows
answers for question
1. you can do this by setting the style property of of the particular combobox to read only
2. check the elements by using for loop that is for i = 0 to combo1.listcount if combo1.text = newinsertigtext then dont add it.
3. by using comboboxname.listcount will return u the number of elements in that combobox
for question number
Dear luchko,
I also have the answers for all of your 3 questions
1. Set the property style = 2 at the design time.
2. I recommend you to add all of your data into the collection with its value as index. At the same time, use the "On Error Resume Next" to ignore once you add the duplicated value into the collection. After all values were added into the collection, you could loop through it and pass the value into the combo box. I believe that this way would provide you faster than check all of the existing value in combo box before adding the new one into.
3. ListCount will return the number of all value added into the combobox.
Meng
Business Accounts
Answer for Membership
by: VKPosted on 2003-07-04 at 06:59:40ID: 8856599
1.
iliconVall ey/Horizon /8806/ comb osearch.ht ml
Private Sub Form_Load()
Dim i As Long
' Set the Combo1.Style = vbComboDropdownList at desgn time !!
For i = Asc("A") To Asc("Z")
Combo1.AddItem Chr(i)
Next
MsgBox Combo1.ListCount
End Sub
2. If you type a text in the closed combo you will get the text of the found item displayed in the combo.
If the text of the combo is like the text displayed in the textbox-portion of the combo ComboBox1.Listindex=-1 will be true.
So you could check this property if you have the need of 1.) too
else do the SEndmessage API:
http://www.geocities.com/S
3. See MsgBox Combo1.ListCount in 1.)
Good luck !
V.K.