谁有VB题目(彩票选号小助手)的程序代码的
发布网友
发布时间:2022-04-26 23:31
我来回答
共1个回答
热心网友
时间:2022-06-20 04:22
Option Explicit
Private Sub Command1_Click()
Dim i As Integer, j As Integer, d As Integer
Dim a As String
d = 1
For i = 0 To 34
Text1(i).Text = Mid$(GenNnm, d, 2)
d = d + 2
Next i
'1-7排序并去初重复
aa:
For i = 1 To 6
For j = 0 To i
If Val(Text1(j).Text) > Val(Text1(i).Text) Then
a = Text1(i).Text
Text1(i).Text = Text1(j).Text
Text1(j).Text = a
End If
Next j
Next i
For j = 0 To 6
If Val(Text1(j).Text) = Val(Text1(j + 1).Text) Then
d = 1
For i = 0 To 6
Text1(i).Text = Mid$(GenNnm, d, 2)
d = d + 2
Next i
GoTo aa
End If
Next j
'7-14排序并去处重复
bb:
For i = 8 To 13
For j = 7 To i
If Val(Text1(j).Text) < Val(Text1(i).Text) Then
a = Text1(i).Text
Text1(i).Text = Text1(j).Text
Text1(j).Text = a
End If
Next j
Next i
For j = 7 To 13
If Val(Text1(j).Text) = Val(Text1(j + 1).Text) Then
d = 15
For i = 7 To 13
Text1(i).Text = Mid$(GenNnm, d, 2)
d = d + 2
Next i
GoTo bb
End If
Next j
'14-21排序并去处重复
cc:
For i = 15 To 20
For j = 14 To i
If Val(Text1(j).Text) < Val(Text1(i).Text) Then
a = Text1(i).Text
Text1(i).Text = Text1(j).Text
Text1(j).Text = a
End If
Next j
Next i
For j = 14 To 20
If Val(Text1(j).Text) = Val(Text1(j + 1).Text) Then
d = 29
For i = 14 To 20
Text1(i).Text = Mid$(GenNnm, d, 2)
d = d + 2
Next i
GoTo cc
End If
Next j
'21-28排序
dd:
For i = 22 To 27
For j = 21 To i
If Val(Text1(j).Text) < Val(Text1(i).Text) Then
a = Text1(i).Text
Text1(i).Text = Text1(j).Text
Text1(j).Text = a
End If
Next j
Next i
For j = 21 To 27
If Val(Text1(j).Text) = Val(Text1(j + 1).Text) Then
d = 43
For i = 21 To 27
Text1(i).Text = Mid$(GenNnm, d, 2)
d = d + 2
Next i
GoTo dd
End If
Next j
'28-35排序并去处重复
ee:
For i = 29 To 34
For j = 28 To i
If Val(Text1(j).Text) < Val(Text1(i).Text) Then
a = Text1(i).Text
Text1(i).Text = Text1(j).Text
Text1(j).Text = a
End If
Next j
Next i
For j = 28 To 33
If Val(Text1(j).Text) = Val(Text1(j + 1).Text) Then
d = 55
For i = 28 To 34
Text1(i).Text = Mid$(GenNnm, d, 2)
d = d + 2
Next i
GoTo ee
End If
Next j
End Sub
Function GenNnm() As String
Dim str1 As String
Dim i As Integer, Num As Integer
Dim usechar As String
usechar = "0102030405060708091011121314151617181920212223242526272829303132333435"
str1 = ""
Randomize
For i = 1 To 36
Num = Len(usechar) * Rnd + 1
If Num Mod 2 = 1 Then
str1 = str1 + Mid(usechar, Num, 2)
Else
str1 = str1 + Mid(usechar, Num - 1, 2)
End If
Next i
GenNnm = str1
End Function
Private Sub Command2_Click()
Dim i As Integer
For i = 0 To 34
Text1(i).Text = ""
Next i
End Sub
Private Sub Command3_Click()
Unload Me
frmLoad.Show
End Sub
Private Sub Form_Load()
Option5.Value = True
End Sub
Private Sub Option1_Click()
Dim i As Integer
For i = 7 To 34
Text1(i).Visible = False
Next i
For i = 0 To 34
Text1(i).Text = ""
Next i
End Sub
Private Sub Option2_Click()
Dim i As Integer
For i = 14 To 34
Text1(i).Visible = False
Next i
For i = 0 To 13
Text1(i).Visible = True
Next i
For i = 0 To 34
Text1(i).Text = ""
Next i
End Sub
Private Sub Option3_Click()
Dim i As Integer
For i = 21 To 34
Text1(i).Visible = False
Next i
For i = 0 To 20
Text1(i).Visible = True
Next i
For i = 0 To 34
Text1(i).Text = ""
Next i
End Sub
Private Sub Option4_Click()
Dim i As Integer
For i = 28 To 34
Text1(i).Visible = False
Next i
For i = 0 To 27
Text1(i).Visible = True
Next i
For i = 0 To 34
Text1(i).Text = ""
Next i
End Sub
Private Sub Option5_Click()
Dim i As Integer
For i = 0 To 34
Text1(i).Visible = True
Next i
For i = 0 To 34
Text1(i).Text = ""
Next i
End Sub