How to return a specific combobo item?

M

mrmagoo

How do I stick an list item from a combobox into the text property of it?
Let's say I want the first item in the combobox list to display.

With cbo
If .Items.Count = 1 then
' Display that item in the combo
.Text = <THAT ITEM> ?
end if
end with

This works, but surely there must be an easier way?

With cbo
If .Items.Count = 1 Then
For Each o In .Items
.Text = o.PropValue
Next
End If
End With

thx
 
C

Chris

mrmagoo said:
How do I stick an list item from a combobox into the text property of it?
Let's say I want the first item in the combobox list to display.

With cbo
If .Items.Count = 1 then
' Display that item in the combo
.Text = <THAT ITEM> ?
end if
end with

This works, but surely there must be an easier way?

With cbo
If .Items.Count = 1 Then
For Each o In .Items
.Text = o.PropValue
Next
End If
End With

thx


With cbo
If .Items.Count = 1 then
' Display that item in the combo
.SelectedIndex = 0
end if
end with

Chris
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top