12.10.2020, 17:04. Показов 1689. Ответов 5
В проекте на форме при нажатии на button5, эта форма зависает, при запуске проекта ошибок нет. Вот код на button5: (Изначально с=2,pass=0, b=любое число меньше 18.)
| VB.NET |
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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
| Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click
Randomize()
5: If (b < 18) And pass = 0 Then
If c = 2 Then
PictureBox10.Visible = True
u = Int((36 * Rnd()) + 1)
4: Label12.Text = Val(u)
If (Label12.Text = Label4.Text) Or (Label12.Text = Label5.Text) Or (Label12.Text = Label6.Text) Or (Label12.Text = Label7.Text) Or (Label12.Text = Label8.Text) Or (Label12.Text = Label9.Text) Or (Label12.Text = Label10.Text) Or (Label12.Text = Label11.Text) Then GoTo 4
If Val(Label12.Text) = 1 Then b = b + 6
If Val(Label12.Text) = 2 Then b = b + 6
If Val(Label12.Text) = 3 Then b = b + 6
If Val(Label12.Text) = 4 Then b = b + 6
If Val(Label12.Text) = 5 Then b = b + 7
If Val(Label12.Text) = 6 Then b = b + 7
If Val(Label12.Text) = 7 Then b = b + 7
If Val(Label12.Text) = 8 Then b = b + 7
If Val(Label12.Text) = 9 Then b = b + 8
If Val(Label12.Text) = 10 Then b = b + 8
If Val(Label12.Text) = 11 Then b = b + 8
If Val(Label12.Text) = 12 Then b = b + 8
If Val(Label12.Text) = 13 Then b = b + 9
If Val(Label12.Text) = 14 Then b = b + 9
If Val(Label12.Text) = 15 Then b = b + 9
If Val(Label12.Text) = 16 Then b = b + 9
If Val(Label12.Text) = 17 Then b = b + 10
If Val(Label12.Text) = 18 Then b = b + 10
If Val(Label12.Text) = 19 Then b = b + 10
If Val(Label12.Text) = 20 Then b = b + 10
If Val(Label12.Text) = 21 Then b = b + 2
If Val(Label12.Text) = 22 Then b = b + 2
If Val(Label12.Text) = 23 Then b = b + 2
If Val(Label12.Text) = 24 Then b = b + 2
If Val(Label12.Text) = 25 Then b = b + 3
If Val(Label12.Text) = 26 Then b = b + 3
If Val(Label12.Text) = 27 Then b = b + 3
If Val(Label12.Text) = 28 Then b = b + 3
If Val(Label12.Text) = 29 Then b = b + 4
If Val(Label12.Text) = 30 Then b = b + 4
If Val(Label12.Text) = 31 Then b = b + 4
If Val(Label12.Text) = 32 Then b = b + 4
If Val(Label12.Text) = 33 Then b = b + 1
If Val(Label12.Text) = 34 Then b = b + 1
If Val(Label12.Text) = 35 Then b = b + 1
If Val(Label12.Text) = 36 Then b = b + 1
c = c + 1
If (b < 18) Then GoTo 5 Else pass = 1
If pass = 1 Then
PictureBox16.Visible = False
PictureBox12.Visible = False
PictureBox11.Visible = False
PictureBox10.Visible = False
PictureBox9.Visible = False
PictureBox13.Visible = False
PictureBox1.Visible = False
PictureBox2.Visible = False
PictureBox3.Visible = False
PictureBox4.Visible = False
PictureBox5.Visible = False
PictureBox7.Visible = False
PictureBox6.Visible = False
Button5.Visible = False
Button1.Visible = False
Label1.Visible = False
Label2.Visible = False
Button4.Visible = False
Button10.Visible = True
End If
End If
If c = 3 Then
PictureBox11.Visible = True
u = Int((36 * Rnd()) + 1)
6: Label13.Text = Val(u)
If (Label13.Text = Label4.Text) Or (Label13.Text = Label5.Text) Or (Label13.Text = Label6.Text) Or (Label13.Text = Label7.Text) Or (Label13.Text = Label8.Text) Or (Label13.Text = Label9.Text) Or (Label13.Text = Label10.Text) Or (Label13.Text = Label11.Text) Or (Label13.Text = Label12.Text) Then GoTo 6
If Val(Label13.Text) = 1 Then b = b + 6
If Val(Label13.Text) = 2 Then b = b + 6
If Val(Label13.Text) = 3 Then b = b + 6
If Val(Label13.Text) = 4 Then b = b + 6
If Val(Label13.Text) = 5 Then b = b + 7
If Val(Label13.Text) = 6 Then b = b + 7
If Val(Label13.Text) = 7 Then b = b + 7
If Val(Label13.Text) = 8 Then b = b + 7
If Val(Label13.Text) = 9 Then b = b + 8
If Val(Label13.Text) = 10 Then b = b + 8
If Val(Label13.Text) = 11 Then b = b + 8
If Val(Label13.Text) = 12 Then b = b + 8
If Val(Label13.Text) = 13 Then b = b + 9
If Val(Label13.Text) = 14 Then b = b + 9
If Val(Label13.Text) = 15 Then b = b + 9
If Val(Label13.Text) = 16 Then b = b + 9
If Val(Label13.Text) = 17 Then b = b + 10
If Val(Label13.Text) = 18 Then b = b + 10
If Val(Label13.Text) = 19 Then b = b + 10
If Val(Label13.Text) = 20 Then b = b + 10
If Val(Label13.Text) = 21 Then b = b + 2
If Val(Label13.Text) = 22 Then b = b + 2
If Val(Label13.Text) = 23 Then b = b + 2
If Val(Label13.Text) = 24 Then b = b + 2
If Val(Label13.Text) = 25 Then b = b + 3
If Val(Label13.Text) = 26 Then b = b + 3
If Val(Label13.Text) = 27 Then b = b + 3
If Val(Label13.Text) = 28 Then b = b + 3
If Val(Label13.Text) = 29 Then b = b + 4
If Val(Label13.Text) = 30 Then b = b + 4
If Val(Label13.Text) = 31 Then b = b + 4
If Val(Label13.Text) = 32 Then b = b + 4
If Val(Label13.Text) = 33 Then b = b + 1
If Val(Label13.Text) = 34 Then b = b + 1
If Val(Label13.Text) = 35 Then b = b + 1
If Val(Label13.Text) = 36 Then b = b + 1
c = c + 1
If (b < 18) Then GoTo 5 Else pass = 1
If pass = 1 Then
PictureBox16.Visible = False
PictureBox12.Visible = False
PictureBox11.Visible = False
PictureBox10.Visible = False
PictureBox9.Visible = False
PictureBox13.Visible = False
PictureBox1.Visible = False
PictureBox2.Visible = False
PictureBox3.Visible = False
PictureBox4.Visible = False
PictureBox5.Visible = False
PictureBox7.Visible = False
PictureBox6.Visible = False
Button5.Visible = False
Button1.Visible = False
Label1.Visible = False
Label2.Visible = False
Button4.Visible = False
Button10.Visible = True
End If
End If
If c = 4 Then
PictureBox12.Visible = True
u = Int((36 * Rnd()) + 1)
7: Label14.Text = Val(u)
If (Label14.Text = Label4.Text) Or (Label14.Text = Label5.Text) Or (Label14.Text = Label6.Text) Or (Label14.Text = Label7.Text) Or (Label14.Text = Label8.Text) Or (Label14.Text = Label9.Text) Or (Label14.Text = Label10.Text) Or (Label14.Text = Label11.Text) Or (Label14.Text = Label12.Text) Or (Label14.Text = Label13.Text) Then GoTo 7
If Val(Label14.Text) = 1 Then b = b + 6
If Val(Label14.Text) = 2 Then b = b + 6
If Val(Label14.Text) = 3 Then b = b + 6
If Val(Label14.Text) = 4 Then b = b + 6
If Val(Label14.Text) = 5 Then b = b + 7
If Val(Label14.Text) = 6 Then b = b + 7
If Val(Label14.Text) = 7 Then b = b + 7
If Val(Label14.Text) = 8 Then b = b + 7
If Val(Label14.Text) = 9 Then b = b + 8
If Val(Label14.Text) = 10 Then b = b + 8
If Val(Label14.Text) = 11 Then b = b + 8
If Val(Label14.Text) = 12 Then b = b + 8
If Val(Label14.Text) = 13 Then b = b + 9
If Val(Label14.Text) = 14 Then b = b + 9
If Val(Label14.Text) = 15 Then b = b + 9
If Val(Label14.Text) = 16 Then b = b + 9
If Val(Label14.Text) = 17 Then b = b + 10
If Val(Label14.Text) = 18 Then b = b + 10
If Val(Label14.Text) = 19 Then b = b + 10
If Val(Label14.Text) = 20 Then b = b + 10
If Val(Label14.Text) = 21 Then b = b + 2
If Val(Label14.Text) = 22 Then b = b + 2
If Val(Label14.Text) = 23 Then b = b + 2
If Val(Label14.Text) = 24 Then b = b + 2
If Val(Label14.Text) = 25 Then b = b + 3
If Val(Label14.Text) = 26 Then b = b + 3
If Val(Label14.Text) = 27 Then b = b + 3
If Val(Label14.Text) = 28 Then b = b + 3
If Val(Label14.Text) = 29 Then b = b + 4
If Val(Label14.Text) = 30 Then b = b + 4
If Val(Label14.Text) = 31 Then b = b + 4
If Val(Label14.Text) = 32 Then b = b + 4
If Val(Label14.Text) = 33 Then b = b + 1
If Val(Label14.Text) = 34 Then b = b + 1
If Val(Label14.Text) = 35 Then b = b + 1
If Val(Label14.Text) = 36 Then b = b + 1
c = c + 1
If (b < 18) Then GoTo 5 Else pass = 1
If pass = 1 Then
PictureBox16.Visible = False
PictureBox12.Visible = False
PictureBox11.Visible = False
PictureBox10.Visible = False
PictureBox9.Visible = False
PictureBox13.Visible = False
PictureBox1.Visible = False
PictureBox2.Visible = False
PictureBox3.Visible = False
PictureBox4.Visible = False
PictureBox5.Visible = False
PictureBox7.Visible = False
PictureBox6.Visible = False
Button5.Visible = False
Button1.Visible = False
Label1.Visible = False
Label2.Visible = False
Button4.Visible = False
Button10.Visible = True
End If
End If
If c = 5 Then
PictureBox13.Visible = True
u = Int((36 * Rnd()) + 1)
8: Label15.Text = Val(u)
If (Label15.Text = Label4.Text) Or (Label15.Text = Label5.Text) Or (Label15.Text = Label6.Text) Or (Label15.Text = Label7.Text) Or (Label15.Text = Label8.Text) Or (Label15.Text = Label9.Text) Or (Label15.Text = Label10.Text) Or (Label15.Text = Label11.Text) Or (Label15.Text = Label12.Text) Or (Label15.Text = Label13.Text) Or (Label15.Text = Label14.Text) Then GoTo 8
If Val(Label15.Text) = 1 Then b = b + 6
If Val(Label15.Text) = 2 Then b = b + 6
If Val(Label15.Text) = 3 Then b = b + 6
If Val(Label15.Text) = 4 Then b = b + 6
If Val(Label15.Text) = 5 Then b = b + 7
If Val(Label15.Text) = 6 Then b = b + 7
If Val(Label15.Text) = 7 Then b = b + 7
If Val(Label15.Text) = 8 Then b = b + 7
If Val(Label15.Text) = 9 Then b = b + 8
If Val(Label15.Text) = 10 Then b = b + 8
If Val(Label15.Text) = 11 Then b = b + 8
If Val(Label15.Text) = 12 Then b = b + 8
If Val(Label15.Text) = 13 Then b = b + 9
If Val(Label15.Text) = 14 Then b = b + 9
If Val(Label15.Text) = 15 Then b = b + 9
If Val(Label15.Text) = 16 Then b = b + 9
If Val(Label15.Text) = 17 Then b = b + 10
If Val(Label15.Text) = 18 Then b = b + 10
If Val(Label15.Text) = 19 Then b = b + 10
If Val(Label15.Text) = 20 Then b = b + 10
If Val(Label15.Text) = 21 Then b = b + 2
If Val(Label15.Text) = 22 Then b = b + 2
If Val(Label15.Text) = 23 Then b = b + 2
If Val(Label15.Text) = 24 Then b = b + 2
If Val(Label15.Text) = 25 Then b = b + 3
If Val(Label15.Text) = 26 Then b = b + 3
If Val(Label15.Text) = 27 Then b = b + 3
If Val(Label15.Text) = 28 Then b = b + 3
If Val(Label15.Text) = 29 Then b = b + 4
If Val(Label15.Text) = 30 Then b = b + 4
If Val(Label15.Text) = 31 Then b = b + 4
If Val(Label15.Text) = 32 Then b = b + 4
If Val(Label15.Text) = 33 Then b = b + 1
If Val(Label15.Text) = 34 Then b = b + 1
If Val(Label15.Text) = 35 Then b = b + 1
If Val(Label15.Text) = 36 Then b = b + 1
PictureBox16.Visible = False
PictureBox12.Visible = False
PictureBox11.Visible = False
PictureBox10.Visible = False
PictureBox9.Visible = False
PictureBox13.Visible = False
PictureBox1.Visible = False
PictureBox2.Visible = False
PictureBox3.Visible = False
PictureBox4.Visible = False
PictureBox5.Visible = False
PictureBox7.Visible = False
PictureBox6.Visible = False
Button5.Visible = False
Button1.Visible = False
Label1.Visible = False
Label2.Visible = False
Button4.Visible = False
Button10.Visible = True
End If
End If
End Sub |
|