Solved

ComboBoxes with dropdownlist style

Posted on 1998-08-30
4
371 Views
Last Modified: 2010-04-30
When fillng list property at runtime with dropdownlist style
it gives me the message "Property is read-only".If I set the style property after filling the list property then it displays "cannot assign to a read-only property" message.
Is there any way to use the comboboxes with the dropdownlist style by filling the list property at runtime.

Thanks in advance
0
Comment
Question by:guvencum
  • 2
  • 2
4 Comments
 

Accepted Solution

by:
vinoopauls earned 40 total points
ID: 1431892
There is only one way i know of:
Fill the combo box
Then iterate thru the items till you get the item you want
Then assign the listindex
This will set the list property for the read only type combo box
For the other style you can directly type
0
 

Author Comment

by:guvencum
ID: 1431893
send me a piece of code please
then I understand what you mean and appreciate you

0
 

Author Comment

by:guvencum
ID: 1431894
send me a piece of code please
then I understand what you mean and appreciate you

0
 

Expert Comment

by:vinoopauls
ID: 1431895
Here the combo box style property is set to 2 ie read only

cmb1.AddItem "one"
cmb1.AddItem "two"
cmb1.AddItem "three"
cmb1.AddItem "four"

    For n = 0 To cmb1.ListCount - 1
        If cmb1.List(n) = "three" Then Exit For
    Next n
    If n < cmb1.ListCount Then
        cmb1.ListIndex = n
    Else
        cmb1.ListIndex = -1
    End If

If there is a simpler way i would be really grateful!!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now