-
Combo Box
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
-
any reason you don't want to use
mycomboBox.Items.Add(textBox1.Text)
mycomboBox.Items.Add(textBox2.Text)
....
-
Well the item exist. Just that I am having problem setting it into view.
-
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 ?
-
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.
-
2 suggestions
1) mycombobox.selectedindex = 3
2) mycombobox.text = "whatever item 3 is" 'when in doubt cheat :-)
-
That's what I did in the end. I cheated :P
Plz don't tell anyone ;)