Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is the list in a combo empty?
Message
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00483822
Message ID:
00483831
Vues:
8
>I have a combo on a form with the style set to 2-Dropdown list. I populate the list through code based on a choice in another combo.
>
>I set the combo to the first item in the list after it is populated with cbo.text = cbo.list(0). Works fine except if the list is empty.
>
>How can I tell if it's empty? I tried .listcount but it has a value of 1 if it's empty or has been populated with only 1 item.

You should use:
if cbo.listcount > 0 then cbo.text = cbo.list(0)

I made some test and listcount is giving me 0 if there is nothing in the list (VB6 SP4).
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform