Add items to LISTBOX

Discussion in 'Web Design & Coding' started by Sanchez, Aug 2, 2004.

  1. Sanchez

    Sanchez OSNN Junior Addict

    Messages:
    14
    I want the listbox in my form to display 3 strings.
    How can I add these 3 strings to the listbox??
    P.S. Don't thinkg Additem works for me...
     
  2. Geffy

    Geffy Moderator Folding Team

    Messages:
    7,805
    Location:
    United Kingdom
    add item??

    HTML code wise it would look like this
    Code:
    <select>
    <option value="item1">First Item Name</option>
    <option value="item2">Second Item Name</option>
    <option value="item3">Third Item Name</option>
    </select>
     
  3. dave holbon

    dave holbon Moderator

    Messages:
    1,014
    Location:
    London England
    What language are you using?
     
  4. Sanchez

    Sanchez OSNN Junior Addict

    Messages:
    14
    thanks, this is all good now
     
  5. XPos

    XPos OSNN Addict

    Messages:
    88
    Location:
    Kansas
    So how did you do it? Did you have to use the Additem property and concatenate the entry?

    Code:
    Dim sString, sItem1, sItem2, sItem3 as String
    sString = sItem1 & " - " & sItem2 & " - " &  sItem3
    Listbox.Additem  sString
    
    'or
    
    'set the column property to 3 and us the vbTab to separate the items
    Listbox.Additem sItem1 vbTab sItem2 vbTab sItem3