Results 1 to 3 of 3

Thread: Populating Comboboxes

  1. #1

    Thread Starter
    Addicted Member Fat_N_Furry's Avatar
    Join Date
    Oct 2002
    Posts
    171

    Exclamation Populating Comboboxes

    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
    Eat long and prosper!
    If someone helps you, find someone you can help.
    If you still have time, click on the darn banner up there and help the forum!

  2. #2
    Your Ad Here! Edneeis's Avatar
    Join Date
    Feb 2000
    Location
    Moreno Valley, CA (SoCal)
    Posts
    7,339
    Well you can either add items one at a time with add()
    VB Code:
    1. dim itm as string="Angelina Jolie"
    2. ComboBox1.Items.Add(itm)

    Or if you have an array of items then with AddRange
    VB Code:
    1. dim itms() as string={"Angelina Jolie","Katie Holmes","Jennifer Aniston"}
    2. 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:
    1. dim ds as New MyDataSource()
    2. ComboBox1.Items.Datasource=ds
    3. ComboBox1.DisplayMember="Name"

  3. #3

    Thread Starter
    Addicted Member Fat_N_Furry's Avatar
    Join Date
    Oct 2002
    Posts
    171
    Thankyou for your quick response and thoroughness! That's just what I needed.

    Furry
    Eat long and prosper!
    If someone helps you, find someone you can help.
    If you still have time, click on the darn banner up there and help the forum!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width