图片附件: 游客没有浏览图片的权限,请
登录 或
注册
关键代码:1、启动窗体代码:
程序代码:
Private Sub Form_Load()
Combo1.Clear
For I = 65 To 90
Combo1.AddItem Chr(I)
Next I
With MSFlexGrid1
.Cols = 4
.Rows = 1
.TextMatrix(0, 0) = Space(1) & "序号"
.TextMatrix(0, 1) = Space(4) & "号码"
.TextMatrix(0, 2) = Space(4) & "状态"
.TextMatrix(0, 3) = Space(4) & "备注"
.ColWidth(0) = 700
.ColWidth(1) = 1200
.ColWidth(2) = 1200
.ColWidth(3) = 1200
End With
End Sub
2、点击【选择录制】的代码:
程序代码:
Private Sub Command2_Click()
If Val(Text1.Text) < 1 Or Val(Text1.Text) > 9801 Then
MsgBox "录制的数量不能大于9801条,也不能小于1条!"
Exit Sub
End If
If Combo1.Text = "" Then
MsgBox "录制的首字母必须选择!"
Exit Sub
End If
Dim LZSL As Integer, SZM As String, LZYS As Integer
Dim AA() As String, BB() As String, CC() As String, I As Integer, J As Integer, ZF1 As String, ZF2 As String, KKL As Integer
LZSL = Val(Text1.Text)
SZM = Combo1.Text
LZYS = LZSL \ 99
If LZSL / 99 = Int(LZSL / 99) Then
LZYS = LZYS '得到99的整数倍
Else
LZYS = LZYS + 1 '得到99的整数倍
End If
ReDim AA(1 To LZYS, 1 To 99), BB(1 To LZYS, 1 To 99), CC(1 To LZYS, 1 To 99)
For I = 1 To LZYS
For J = 1 To 99
KKL = KKL + 1
If KKL > LZSL Then Exit For
If I < 10 Then
ZF1 = "0" & CStr(I)
Else
ZF1 = CStr(I)
End If
If J < 10 Then
ZF2 = "0" & CStr(J)
Else
ZF2 = CStr(J)
End If
AA(I, J) = SZM & ZF1 & "-" & ZF2 '生成号码
BB(I, J) = "使用" '生成状态
CC(I, J) = "无" '生成备注
Next J
Next I
KKL = 0
MSFlexGrid1.Clear
With MSFlexGrid1
.Cols = 4
.Rows = 1 + LZSL
.TextMatrix(0, 0) = Space(1) & "序号"
.TextMatrix(0, 1) = Space(4) & "号码"
.TextMatrix(0, 2) = Space(4) & "状态"
.TextMatrix(0, 3) = Space(4) & "备注"
.ColWidth(0) = 700
.ColWidth(1) = 1200
.ColWidth(2) = 1200
.ColWidth(3) = 1200
For I = 1 To LZYS
For J = 1 To 99
KKL = KKL + 1
If KKL > LZSL Then Exit For
.TextMatrix((I - 1) * 99 + J, 0) = (I - 1) * 99 + J
.TextMatrix((I - 1) * 99 + J, 1) = AA(I, J)
.TextMatrix((I - 1) * 99 + J, 2) = BB(I, J)
.TextMatrix((I - 1) * 99 + J, 3) = CC(I, J)
Next J
Next I
End With
End Sub