IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

Récupération du choix d'une combobox


Sujet :

VB.NET

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Candidat au Club
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    3
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 3
    Par défaut Récupération du choix d'une combobox
    Bonjour,

    Je suis étudiant et je cherche à développer un programme.

    Dans une partie de mon programme je fais des choix à l'aide de combobx et je voudrais savoir comment je pourrais enregistrer (sauvegarder) les diférents choix des combobox, pour ensuite les exploiter dans d'autres parties.

    Il y a 30 combobox en tout. Le choix des 26 dernières combobox est influencé par le choix des 4 premières combobox.


    ceci est pour commander, insérer les différents choix possible dans les 4 première combobox:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    Private Sub PrendreCommande_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            With ComboBox1.Items
                .Add("Menu Enfant")
                .Add("Menu Doubiste")
                .Add("Menu Anglais")
                .Add("Menu Italien")
            End With
            With ComboBox2.Items
                .Add("Menu Enfant")
                .Add("Menu Doubiste")
                .Add("Menu Anglais")
                .Add("Menu Italien")
            End With
            With ComboBox3.Items
                .Add("Menu Enfant")
                .Add("Menu Doubiste")
                .Add("Menu Anglais")
                .Add("Menu Italien")
            End With
            With ComboBox4.Items
                .Add("Menu Enfant")
                .Add("Menu Doubiste")
                .Add("Menu Anglais")
                .Add("Menu Italien")
            End With
            With ComboBox5.Items
                .Add("Menu Enfant")
                .Add("Menu Doubiste")
                .Add("Menu Anglais")
                .Add("Menu Italien")
            End With
            With ComboBox6.Items
                .Add("Menu Enfant")
                .Add("Menu Doubiste")
                .Add("Menu Anglais")
                .Add("Menu Italien")
            End With
            ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox2.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox3.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox4.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox5.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox6.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox7.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox8.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox9.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox10.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox11.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox12.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox13.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox14.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox15.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox16.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox17.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox18.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox19.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox20.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox21.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox22.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox23.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox24.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox25.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox26.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox27.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox28.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox29.DropDownStyle = ComboBoxStyle.DropDownList
            ComboBox30.DropDownStyle = ComboBoxStyle.DropDownList
     
        End Sub
    Ceci est le codage pour la première combobox qui contraint 4 autres combobox (soi la 7, 8, 9, 10) et qui est le même pour la 2eme la 3 eme jusqu'a là 6eme qui contraignent respectivement les combobox 11, 12, 13, 14 ; 15, 16, 17, 18 ; 19, 20, 21, 22 ......

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
            ComboBox7.Items.Clear()
            ComboBox8.Items.Clear()
            ComboBox9.Items.Clear()
            ComboBox10.Items.Clear()
            Select Case ComboBox1.SelectedItem
                Case "Menu Enfant"
                    With ComboBox7.Items
                        .Add("Assiette de charcuterie")
                        .Add("Soupe de Legumes")
                        .Add("Tarte aux fromages")
                    End With
                    With ComboBox8.Items
                        .Add("Steak Haché et Frites")
                        .Add("Cordon bleu et pommes de terre frites")
                        .Add("Pattes et Nuggets")
                    End With
                    With ComboBox9.Items
                        .Add("Boules de glace")
                        .Add("Fondant au chocolat")
                        .Add("Créme brulée")
                    End With
                    With ComboBox10.Items
                        .Add("Fanta")
                        .Add("Coca")
                        .Add("Vitel")
                    End With
                Case "Menu Doubiste"
                    With ComboBox7.Items
                        .Add("Salade Paysanne")
                        .Add("Salade Mortuacienne")
                        .Add("Terrine Maison")
                    End With
                    With ComboBox8.Items
                        .Add("Rushtis de pomme de terre")
                        .Add("Morbiflette")
                        .Add("Mont d'Or Chaud")
                    End With
                    With ComboBox9.Items
                        .Add("Glaces au choix")
                        .Add("Fondant au chocolat")
                        .Add("Créme brulée")
                    End With
                    With ComboBox10.Items
                        .Add("Pontarlier")
                        .Add("Coca")
                        .Add("Vitel")
                    End With
                Case "Menu Anglais"
                    With ComboBox7.Items
                        .Add("Saumon en croute")
                        .Add("Sheperd's pie en verrine")
                        .Add("Diccalillu traditionnel")
                    End With
                    With ComboBox8.Items
                        .Add("Gigot à la menthe")
                        .Add("Fish and Chips")
                        .Add("Haggis")
                    End With
                    With ComboBox9.Items
                        .Add("Gelée")
                        .Add("Pudding fondant à la crème")
                        .Add("Irish Coffee")
                    End With
                    With ComboBox10.Items
                        .Add("Wisky")
                        .Add("Sprit")
                        .Add("Eau gazeuse")
                    End With
                Case "Menu Italien"
                    With ComboBox7.Items
                        .Add("Citron farcis au thon")
                        .Add("Salade de tomates, mozarella et pesto")
                        .Add("Jambon de Parme")
                    End With
                    With ComboBox8.Items
                        .Add("Patte à la carbonnara")
                        .Add("Pizza")
                        .Add("Carpaccio et Risoto")
                    End With
                    With ComboBox9.Items
                        .Add("Tiramissu")
                        .Add("Glace à l'italienne")
                        .Add("Assiete de Fromage")
                    End With
                    With ComboBox10.Items
                        .Add("Coca Cola")
                        .Add("Eau pétillante")
                        .Add("Vin Italien")
                    End With
            End Select
        End Sub
    Ceci est la partie validation sur l'appui d'un bouton (button)
    et c'est là que je voudrais récupérer les information sur les combobox
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
     
     
            ComboBox1.Items.Clear()
            ComboBox2.Items.Clear()
            ComboBox3.Items.Clear()
            ComboBox4.Items.Clear()
            ComboBox5.Items.Clear()
            ComboBox6.Items.Clear()
            ComboBox7.Items.Clear()
            ComboBox8.Items.Clear()
            ComboBox9.Items.Clear()
            ComboBox10.Items.Clear()
            ComboBox11.Items.Clear()
            ComboBox12.Items.Clear()
            ComboBox13.Items.Clear()
            ComboBox14.Items.Clear()
            ComboBox15.Items.Clear()
            ComboBox16.Items.Clear()
            ComboBox17.Items.Clear()
            ComboBox18.Items.Clear()
            ComboBox19.Items.Clear()
            ComboBox20.Items.Clear()
            ComboBox21.Items.Clear()
            ComboBox22.Items.Clear()
            ComboBox23.Items.Clear()
            ComboBox24.Items.Clear()
            ComboBox25.Items.Clear()
            ComboBox26.Items.Clear()
            ComboBox27.Items.Clear()
            ComboBox28.Items.Clear()
            ComboBox29.Items.Clear()
            ComboBox30.Items.Clear()
            ValNbClient.Value = 0
            ValNumTab.Value = 0
     
            Me.Close()
        End Sub

    Merci d'avance

  2. #2
    Candidat au Club
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    3
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 3
    Par défaut
    Est ce possible d'afficher le résultat de ces combobox dans une autre fenêtre sous forme de liste ou autres système de ce genre ?

  3. #3
    Membre éprouvé
    Homme Profil pro
    Inscrit en
    Mars 2008
    Messages
    161
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations forums :
    Inscription : Mars 2008
    Messages : 161
    Par défaut
    Bonjour,

    Pourquoi tu n'utiliserais pas les listbox au lieu des combo ?

  4. #4
    Candidat au Club
    Profil pro
    Inscrit en
    Janvier 2011
    Messages
    3
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Janvier 2011
    Messages : 3
    Par défaut
    Bonjour,

    Ben je ne sais pas trop les utiliser, j'ai fait des " list of " mais je ne savais pas comment les insérer dans des listbox.

    Donc du coup j'ai fait des combobox

    Est ce possible de mettre des list of dans des listbox pour pouvoir faire des choix qui pourrait être récupérer ensuite ?

Discussions similaires

  1. [XL-2003] faire apparaitre un label en fonction d'un choix d'une combobox
    Par revemane dans le forum Macros et VBA Excel
    Réponses: 6
    Dernier message: 11/06/2009, 20h00
  2. Ajouter des choix dans une comboBox
    Par DarkSeiryu dans le forum Windows Forms
    Réponses: 9
    Dernier message: 22/01/2009, 11h43
  3. erreur suite à récupération du contenu d'une combobox
    Par Freud44 dans le forum Débuter avec Java
    Réponses: 3
    Dernier message: 22/07/2008, 17h34
  4. Mise à jour d'une variable après choix dans une combobox
    Par ~Brouette~ dans le forum Langage
    Réponses: 1
    Dernier message: 21/12/2007, 11h09
  5. Affichage des infos après le choix d'une combobox
    Par manplum dans le forum Général JavaScript
    Réponses: 2
    Dernier message: 07/08/2006, 10h31

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo