combobox multiple entry

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sreegans
    New Member
    • Apr 2008
    • 9

    combobox multiple entry

    Hi...

    how to avoid multiple entry display in combo box?

    ie) if we are displaying the TV List in Combo...

    combo1.additem "samsung"
    combo1.additem "onida"
    combo1.additem "samsung"

    how to disaply onida and samsung one time...?

    Sree..
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    You need to check if the item already exists before adding that to the list.

    Comment

    • lotus18
      Contributor
      • Nov 2007
      • 865

      #3
      Originally posted by sreegans
      Hi...

      how to avoid multiple entry display in combo box?

      ie) if we are displaying the TV List in Combo...

      combo1.additem "samsung"
      combo1.additem "onida"
      combo1.additem "samsung"

      how to disaply onida and samsung one time...?

      Sree..
      Doing loops will fix this.

      Rey Sean

      Comment

      • kuzen
        New Member
        • Dec 2006
        • 20

        #4
        Code:
        dim Exists as boolean=false
        for i as integer=0 to your_combo.items.count-1 do
        if your_combo.items.item(i)=new_equipment_name then
        Exists=true;
        exit for;
        end if
        next
        
        if not Exists then
        your_combo.items.add(new_equipment_name)
        else
        msgbox("Already in the list")
        end if

        Comment

        Working...