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:
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:
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:
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