Click to See Complete Forum and Search --> : Combo Box
MoonNight
December 9th, 2002, 02:56 PM
Hi!
I would like to update the selected item of a combo box after a bunch of algo have been performed.
I used this:
' I first clear it
myComboBox.text = " "
' Then I set it later on in my code using the following
myComboBox.selecteditem = index
My problem is that sometimes it shows the right value, sometimes it stays blank.
Help!
Thank you
Jym
December 9th, 2002, 03:32 PM
any reason you don't want to use
mycomboBox.Items.Add(textBox1.Text)
mycomboBox.Items.Add(textBox2.Text)
....
MoonNight
December 9th, 2002, 03:34 PM
Well the item exist. Just that I am having problem setting it into view.
Jym
December 9th, 2002, 03:56 PM
ok maybe I read your question wrong, sorry the list exists already and you just want to change the Drop down box text so it shows the value of "index" in the top part ?
or are you using index as a value like index = 2 therefore you want the second one to be the selecteditem ?
MoonNight
December 10th, 2002, 07:03 AM
I got it set to 2. Then I clear it. After that, I want to set it to 3. I tried doing it seperately from my program and it works. I think that it might be that something overwrote it before it showed on the interface.
Thank you for your help.
Jym
December 10th, 2002, 07:26 AM
2 suggestions
1) mycombobox.selectedindex = 3
2) mycombobox.text = "whatever item 3 is" 'when in doubt cheat :-)
MoonNight
December 10th, 2002, 07:27 AM
That's what I did in the end. I cheated :P
Plz don't tell anyone ;)
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.