Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
ComboBox value
Message
 
À
18/01/2000 04:40:33
Information générale
Forum:
Visual Basic
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
00319339
Message ID:
00319423
Vues:
10
>Hello,
>
>I do have a combobox FormX.Combo1 in which I have listed the following values:
>Name
>Period
>Type
>
>Now I would like to get the selected value out of the Box. So if I say variable1 = FormX.Combo1.Text I get the selected value.
>
>However I don't want this value, I would like to get it like this
>
>FormX.Combo1 wanted value:
>Name t.name
>Period date
>Type type
>
>So how can I display certain list items and get a different value ?

Try this.

Place 2 combo on a form and copy this code:
Private Sub Combo1_Click()
    If Combo1.ListIndex <> -1 Then
        MsgBox Combo2.List(Combo1.ListIndex)
    End If
End Sub

Private Sub Form_Load()
    With Combo1
        .AddItem "Name"
        .AddItem "Period"
        .AddItem "Type"
    End With
    
    With Combo2
        .AddItem "t.name"
        .AddItem "date"
        .AddItem "type"
        .Visible = False
    End With
End Sub
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform