Bonjour,
Je travaille actuellement sur une application pour gérer des Quizz. Chacun d'eux comprend 10 Questions avec pour chacune d'elle 4 propositions de réponse, la réponse et enfin d'éventuelles informations pour expliquer la réponse.
Pour ce faire j'ai créé 1 TextBox pour le nom du Quizz, 10 TextBox (1 par Question), 4 TextBox par questions pour les 4 propositions de réponse, 1 TextBox par questions pour la réponse exacte, 2 Label (Un pour indique s'il y a ou non une information et un pour l'information en elle même)
Les données de l'ensemble de ces TextBox sont enregistrées dans des ComboBox et des ListBox. Le nom du Quizz est enregistré dans la CombBox, les questions dans une ListeBox, les propositions 1, 2, 3 et 4 chacune dans des listbox distinctes, les réponses dans une autre ListBox et enfin les mentions d'informations et les information dans les 2 dernières ListBox.
Ce qui fait que dans la ComboBox j'ai Une entrée par Quizz, et dans les ListBox 10 entrées Par Quizz.
Pour remplir mes TextBox et mes Label, j'utiliste le code suivant qui fonctionne parfaitement bien pour l'index "0" de la Cb_QuizzList (ComboBox avec le nom du quizz) :
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115 Private Sub Cb_ListeQuizz_SelectedIndexChanged(sender As Object, e As EventArgs) Handles Cb_ListeQuizz.SelectedIndexChanged 'Charge le quizz en mémoire dans les boites Text Dim Index1 As Integer = -1 For a = 0 To 9 Index1 = Index1 + 1 Lb_QuizzQuestion.SelectedIndex = Cb_ListeQuizz.SelectedIndex + Index1 Lb_QuizzProposition1.SelectedIndex = Cb_ListeQuizz.SelectedIndex + Index1 Lb_QuizzProposition2.SelectedIndex = Cb_ListeQuizz.SelectedIndex + Index1 Lb_QuizzProposition3.SelectedIndex = Cb_ListeQuizz.SelectedIndex + Index1 Lb_QuizzProposition4.SelectedIndex = Cb_ListeQuizz.SelectedIndex + Index1 Lb_QuizzReponse.SelectedIndex = Cb_ListeQuizz.SelectedIndex + Index1 Lb_QuizzInfo.SelectedIndex = Cb_ListeQuizz.SelectedIndex + Index1 Lb_QuizzInfo1.SelectedIndex = Cb_ListeQuizz.SelectedIndex + Index1 If Index1 = 0 Then Tb_Question1.Text = Lb_QuizzQuestion.Text Tb_P11.Text = Lb_QuizzProposition1.Text Tb_P12.Text = Lb_QuizzProposition2.Text Tb_P13.Text = Lb_QuizzProposition3.Text TB_P14.Text = Lb_QuizzProposition4.Text Tb_Rep1.Text = Lb_QuizzReponse.Text Lab_QuizzInfo1.Text = Lb_QuizzInfo.Text Lab_QuizzInfo11.Text = Lb_QuizzInfo1.Text End If If Index1 = 1 Then Tb_Question2.Text = Lb_QuizzQuestion.Text Tb_P21.Text = Lb_QuizzProposition1.Text Tb_P22.Text = Lb_QuizzProposition2.Text Tb_P23.Text = Lb_QuizzProposition3.Text Tb_P24.Text = Lb_QuizzProposition4.Text Tb_Rep2.Text = Lb_QuizzReponse.Text Lab_QuizzInfo2.Text = Lb_QuizzInfo.Text Lab_QuizzInfo20.Text = Lb_QuizzInfo1.Text End If If Index1 = 2 Then Tb_Question3.Text = Lb_QuizzQuestion.Text Tb_P31.Text = Lb_QuizzProposition1.Text Tb_P32.Text = Lb_QuizzProposition2.Text Tb_P33.Text = Lb_QuizzProposition3.Text Tb_P34.Text = Lb_QuizzProposition4.Text Tb_Rep3.Text = Lb_QuizzReponse.Text Lab_QuizzInfo3.Text = Lb_QuizzInfo.Text Lab_QuizzInfo30.Text = Lb_QuizzInfo1.Text End If If Index1 = 3 Then Tb_Question4.Text = Lb_QuizzQuestion.Text Tb_P41.Text = Lb_QuizzProposition1.Text Tb_P42.Text = Lb_QuizzProposition2.Text Tb_P43.Text = Lb_QuizzProposition3.Text TB_P44.Text = Lb_QuizzProposition4.Text Tb_Rep4.Text = Lb_QuizzReponse.Text Lab_QuizzInfo4.Text = Lb_QuizzInfo.Text Lab_QuizzInfo40.Text = Lb_QuizzInfo1.Text End If If Index1 = 4 Then Tb_Question5.Text = Lb_QuizzQuestion.Text Tb_P51.Text = Lb_QuizzProposition1.Text Tb_P52.Text = Lb_QuizzProposition2.Text Tb_P53.Text = Lb_QuizzProposition3.Text Tb_P54.Text = Lb_QuizzProposition4.Text Tb_Rep5.Text = Lb_QuizzReponse.Text Lab_QuizzInfo5.Text = Lb_QuizzInfo.Text Lab_QuizzInfo50.Text = Lb_QuizzInfo1.Text End If If Index1 = 5 Then Tb_Question6.Text = Lb_QuizzQuestion.Text Tb_P61.Text = Lb_QuizzProposition1.Text Tb_P62.Text = Lb_QuizzProposition2.Text Tb_P63.Text = Lb_QuizzProposition3.Text Tb_P64.Text = Lb_QuizzProposition4.Text Tb_Rep6.Text = Lb_QuizzReponse.Text Lab_QuizzInfo6.Text = Lb_QuizzInfo.Text Lab_QuizzInfo60.Text = Lb_QuizzInfo1.Text End If If Index1 = 6 Then Tb_Question7.Text = Lb_QuizzQuestion.Text Tb_P71.Text = Lb_QuizzProposition1.Text Tb_P72.Text = Lb_QuizzProposition2.Text Tb_P73.Text = Lb_QuizzProposition3.Text Tb_P74.Text = Lb_QuizzProposition4.Text Tb_Rep7.Text = Lb_QuizzReponse.Text Lab_QuizzInfo7.Text = Lb_QuizzInfo.Text Lab_QuizzInfo70.Text = Lb_QuizzInfo1.Text End If If Index1 = 7 Then Tb_Question8.Text = Lb_QuizzQuestion.Text Tb_P81.Text = Lb_QuizzProposition1.Text Tb_P82.Text = Lb_QuizzProposition2.Text Tb_P83.Text = Lb_QuizzProposition3.Text Tb_P84.Text = Lb_QuizzProposition4.Text Tb_Rep8.Text = Lb_QuizzReponse.Text Lab_QuizzInfo8.Text = Lb_QuizzInfo.Text Lab_QuizzInfo80.Text = Lb_QuizzInfo1.Text End If If Index1 = 8 Then Tb_Question9.Text = Lb_QuizzQuestion.Text Tb_P91.Text = Lb_QuizzProposition1.Text Tb_P92.Text = Lb_QuizzProposition2.Text Tb_P93.Text = Lb_QuizzProposition3.Text Tb_P94.Text = Lb_QuizzProposition4.Text Tb_Rep9.Text = Lb_QuizzReponse.Text Lab_QuizzInfo9.Text = Lb_QuizzInfo.Text Lab_QuizzInfo90.Text = Lb_QuizzInfo1.Text End If If Index1 = 9 Then Tb_Question10.Text = Lb_QuizzQuestion.Text Tb_P101.Text = Lb_QuizzProposition1.Text Tb_P102.Text = Lb_QuizzProposition2.Text Tb_P103.Text = Lb_QuizzProposition3.Text Tb_P104.Text = Lb_QuizzProposition4.Text Tb_Rep10.Text = Lb_QuizzReponse.Text Lab_QuizzInfo10.Text = Lb_QuizzInfo.Text Lab_QuizzInfo100.Text = Lb_QuizzInfo1.Text End If Next End Sub
Cela fonctionne bien avec l'index "0" de la Cb_ListQuizz car il prend bien e compte les index "0" à "9" des ListBox pour remplir le TextBosx et les Label.
Là ou cela se gâte c'est qu'and j'appel l'index "1" de la Cb_QuizzList. En effet, il prend en compte les index "1" à "10" des Listbox alors que de par ma config je voudrais qu'il prenne les index "20 à "29" et pour l'index "2" de la Cb_QuizzListe, les index "30" à "39" et ainsi de suite.
Je sais que mon code ne permet de faire fonctionner comme je le voudrais et c'est là que j'ai besoin de votre aide.
Merci par avance à celui celle qui pourra me filer un coup de main pour que ca marche.
Encore Merci
@+ Martipit
Partager