Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Scan to Item in Combo Based on ValueMember
Message
De
21/10/2003 12:21:29
 
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
00840605
Message ID:
00840711
Vues:
29
>How do I determine the index of an item in a combobox based on the valuemember property?<

Are you talking about the selected item of a combobox or do you just want to scan through each item until you find the one you're looking for?

There's quite a few .Selected properties (.SelectedIndex, .SelectedItem, .SelectedIndices, etc.) if that's what you're looking for.

If you just want to scan through each item, then do something like this:
for (int i=0; i < MyCombo.Items.Count; i++)
{
    if (MyCombo.Items[i].ToString() == WhatToLookFor)
    {
        // put code here for finding it
        break;
    }
}
~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform