By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,749 Members | 1,615 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,749 IT Pros & Developers. It's quick & easy.

populate a combobox

P: n/a
in VB. net

how do you populate a combobox with items?

thanks

portroe

Nov 20 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
there are different ways:
in design go to the combo en select the items property
in code
combo.items.add("ze item")
(if you have your own class that has a tostring)
combo.items.add(instanceofyourclass)

or you can make the combo bound to a datasource

hope it helps

eric

"portroe" <bo*@sleigh.com> wrote in message
news:Op**************@TK2MSFTNGP10.phx.gbl...
in VB. net

how do you populate a combobox with items?

thanks

portroe

Nov 20 '05 #2

P: n/a
* portroe <bo*@sleigh.com> scripsit:
in VB. net

how do you populate a combobox with items?


\\\
Me.ComboBox1.Items.Add("Foo")
Me.ComboBox1.Items.AddRange(New String() {"Item1", "Item2", ...})
///

- or -

\\\
With Me.ListBox1
.DataSource = Database.FindPeople(...)
.DisplayMember = "Name"
.ValueMember = "Age"
End With
///

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.