adding items to comboboxes

hog

Well-known member
Joined
Mar 17, 2003
Messages
984
Location
UK
If I add a list of items to a combobox any ideas on how I solve the following:

I assign 5 values to a combobox using the items.add method, but when I try to query the users selection using selectedvalue it returns nothing. Is there some other way to add items, or is there a step I have missed.

Also how do I make the first item added to the list appear in the combobox, cuurently it appears blank and the user has to click on the control to display the values.

On other comboboxes on the form which I have pre assigned values I use selectedvalue and it works ok
 
Aha got the query result ok, SelectedItem not SelectedValue.

Just need to suss the displaying the first item...
 
Aha.....that works a treat...ta

Also I was always taught the following about programming..

There is no wrong way to program, as if it works its right. There is only efficient and inefficient ways to program!

PS like you name.......does it mean what it I think it means? :-))
 
fraid so - was the result of trying to think of a name for a Quake2 LAN session after a few too many beers, kind of stuck because I find it amusing.
 
Id use "ComboBox1.SelectedIndex = 0" to select the first item. Setting the Text property may work, but it will cause an error if the style is set to dropdownlist (where you cant type in values in the ComboBox).

-Nerseus
 
Back
Top