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
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
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"})