Hello, all. First time posting in this forum. How do you like my avatar?
I was wondering - how do you populate a combobox in .NET?
I know this is a pretty basic question, but bear with me until I get a book on .NET.
Thanks in advance,
Furry
Printable View
Hello, all. First time posting in this forum. How do you like my avatar?
I was wondering - how do you populate a combobox in .NET?
I know this is a pretty basic question, but bear with me until I get a book on .NET.
Thanks in advance,
Furry
Well you can either add items one at a time with add()
VB Code:
dim itm as string="Angelina Jolie" ComboBox1.Items.Add(itm)
Or if you have an array of items then with AddRange
VB Code:
dim itms() as string={"Angelina Jolie","Katie Holmes","Jennifer Aniston"} ComboBox1.Items.AddRange(itms)
Or if by change your item is either data or implements IList or IListSource then you can use the datasource property
VB Code:
dim ds as New MyDataSource() ComboBox1.Items.Datasource=ds ComboBox1.DisplayMember="Name"
Thankyou for your quick response and thoroughness! That's just what I needed.
Furry