无聊到帮人写作业
程序代码:
Option Explicit
Dim MyNumber() As String, NumRange As Integer
Dim MyNumber1() As String
Private Sub Command1_Click()
Dim i As Integer, j As Integer, tmpNumRange As Integer
Dim X As String
NumRange = Val(Text1.Text)
X = Val(Text2.Text)
If ((NumRange > 14) And (X > 1)) Then
tmpNumRange = NumRange
ReDim MyNumber(X, NumRange)
For i = 0 To UBound(MyNumber, 1)
For j = 0 To tmpNumRange
MyNumber(i, j) = j + 1
Next j
tmpNumRange = tmpNumRange - 1
Next i
Call GetNumber
Else
MsgBox "Number Too Small !"
End If
Text1.Text = ""
End Sub
Private Sub Text1_Change()
Text1.Text = Val(Text1.Text)
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If ((KeyAscii < 48) Or (KeyAscii > 57)) Then Exit Sub
End Sub
Private Sub Text2_Change()
Text2.Text = Val(Text2.Text)
End Sub
Private Sub Text2_KeyPress(KeyAscii As Integer)
If ((KeyAscii < 48) Or (KeyAscii > 57)) Then Exit Sub
End Sub
Private Sub GetNumber()
Dim i As Integer, j As Integer, k As Integer
Dim tmpNumRange As Integer, SN As Integer
k = UBound(MyNumber, 1)
ReDim MyNumber1(k)
For i = 0 To k
If i = 0 Then tmpNumRange = UBound(MyNumber, 2)
For j = 0 To 4
Randomize
SN = CInt(Rnd * tmpNumRange)
If MyNumber1(i) <> "" Then
MyNumber1(i) = MyNumber1(i) & "-" & MyNumber(i, SN)
Else
MyNumber1(i) = MyNumber(i, SN)
End If
Next j
tmpNumRange = tmpNumRange - 1
Next i
MsgBox Join(MyNumber1, vbCrLf)
End Sub
最后一句我看不懂意思...