Bonjour Bonjour,
Je me suis mis au VB.NET il y a quelques jours, j'ai donc regulièrement des erreurs, dont une que je ne sais pas du tout résoudre (erreur: La conversion de la chaîne "ComboBox" en type 'Double' n'est pas valide.) , voici le code:
Et voici la ligne avec l'erreur en question:
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152 Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click If CheckBox1.Checked = True And (ComboBox50.Text = "" Or ComboBox51.Text = "" Or ComboBox52.Text = "" Or ComboBox53.Text = "" Or ComboBox54.Text = "" Or ComboBox55.Text = "" Or ComboBox56.Text = "" Or ComboBox57.Text = "" Or ComboBox58.Text = "") Then CheckBox1.Checked = False End If RichTextBox1.Visible = False Dim C1 As Integer = "49" For C1 = 49 To 57 Dim de1 = "" Dim unite1 = "" Dim A1 = "" C1 = C1 + "1" Dim CB1 = "ComboBox" + C1 + ".Text" Dim TB1 = "TextBox" + C1 + ".Text" Dim LB1 = "ListBox" + C1 + ".Text" Dim LBL1V = "Label" + C1 + ".Visible" Dim LBL1T = "Label" + C1 + ".Text" Dim LBL2V = "Label" + C1 + ".Visible" Dim LBL2T = "Label" + C1 + ".Text" If CB1 = "" And TB1 = "" And LB1 = "" Then A1 = "" Else A1 = "- " End If If Not LB1 = "" And (Not CB1 = "" Or Not TB1 = "") Then de1 = "de " End If If Not CB1 = "" And Not TB1 = "" And LB1 = "Unité(s) " Then unite1 = "" de1 = "" Else unite1 = LB1 End If If Label17.Text = "1" Then LBL1V = True LBL1T = A1 + TB1 + " " + unite1 + de1 + CB1 Else LBL2V = True LBL2T = A1 + TB1 + " " + unite1 + de1 + CB1 End If Next If Not TextBox2.Text = "" Then Label38.Visible = True Label38.Text = "Temps de cuisson: " + TextBox2.Text + " minutes" If RadioButton4.Checked Then Label38.Visible = False End If Else Label38.Visible = False End If If Not TextBox4.Text = "" Then Label34.Visible = True Label34.Text = "Temps de préparation: " + TextBox4.Text + " minutes" End If If Not TextBox6.Text = "" Then Label36.Visible = True Label36.Text = "Temps de repos: " + TextBox6.Text + " minutes" End If If CheckBox1.Checked Then ComboBox50.Text = "" ComboBox51.Text = "" ComboBox52.Text = "" ComboBox53.Text = "" ComboBox54.Text = "" ComboBox55.Text = "" ComboBox56.Text = "" ComboBox57.Text = "" ComboBox58.Text = "" TextBox50.Text = "" TextBox51.Text = "" TextBox52.Text = "" TextBox53.Text = "" TextBox54.Text = "" TextBox55.Text = "" TextBox56.Text = "" TextBox57.Text = "" TextBox58.Text = "" ListBox50.Text = "" ListBox51.Text = "" ListBox52.Text = "" ListBox53.Text = "" ListBox54.Text = "" ListBox55.Text = "" ListBox56.Text = "" ListBox57.Text = "" ListBox58.Text = "" If Label17.Text = 1 Then ingre = ("10") Label17.Text = "10" Label26.Text = "11" Label25.Text = "12" Label24.Text = "13" Label23.Text = "14" Label22.Text = "15" Label21.Text = "16" Label20.Text = "17" Label19.Text = "18" CheckBox1.Text = "Aller aux Ingrédients 1 a 9 après la Validation" Else ingre = ("1") Label17.Text = "1" Label26.Text = "2" Label25.Text = "3" Label24.Text = "4" Label23.Text = "5" Label22.Text = "6" Label21.Text = "7" Label20.Text = "8" Label19.Text = "9" CheckBox1.Text = "Aller aux Ingrédients 10 a 18 après la Validation" End If End If CheckBox1.Checked = False End Sub
Si quelqu'un à une solution, je suis bien sur preneur
Code : Sélectionner tout - Visualiser dans une fenêtre à part Dim CB1 = "ComboBox" + C1 + ".Text"et si vous avez quelques trucs et astuces pour améliorer le code plus haut, je suis aussi preneur
![]()
Partager