views:

150

answers:

1

I want to setup values for a combobox in vb.net through code. But I don't know what's the code for setting it up. please help. I want to do something like this:

if combobox1.selecteditem="1" then
    combobox2.values=("x", "y", "z")
end if
+2  A: 

You use the ComboBox.Items collection's Add or AddRange methods.

Dim b As ComboBox

' Add them one at a time
b.Items.Add("a")
b.Items.Add("b")
b.Items.Add("c")

' Or in one go
b.Items.AddRange(new string() {"a", "b", "c"})
Snarfblam
upvoted but the Q is tagged vb.net
hawbsl
Yeah, I noticed that right after I posted.
Snarfblam