isnoend2001
asked on
Select item in combo box using the text property
I have a combo box that holds titles of different sections of an .ini file. When a selection is made it gets the data from .ini file. The data is then loaded into a Mshflexgrid. Users can add and rename sections. I have 1 section that cannot be renamed or deleted called "All Materials". I never know the index as it can change when sections are added or deleted
How can i programically select "All materials"
How can i programically select "All materials"
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Dim l As Integer
For l = 0 To Combo1.ListCount - 1
If Combo1.List(l) = "All Materials" Then
'Combo1.Text = Combo1.List(l)
Combo1.ListIndex = 1
Exit For
End If
Next l
For l = 0 To Combo1.ListCount - 1
If Combo1.List(l) = "All Materials" Then
'Combo1.Text = Combo1.List(l)
Combo1.ListIndex = 1
Exit For
End If
Next l
Yes. That, too, would do it.
ASKER
I modified it to select the item and it works.
For l = 0 To Combo1.ListCount - 1
If Combo1.List(l) = "All Materials" Then
'Combo1.Text = Combo1.List(l)
Combo1.ListIndex = 1
Exit For
End If
Next l