求VB读取程序文件夹下的name.txt并将其内文件作为文本去执行文件? 25
'添加Command1Text1Timer1Dima()AsStringDimi%,cjnum%,tper%,groupname$PrivateSubForm_Load(...
'添加 Command1 Text1 Timer1
Dim a() As String
Dim i%, cjnum%, tper%, groupname$
Private Sub Form_Load()
groupname = "A,B,C,D,E,F,G,H,I"
Call getname
Timer1.Interval = 10
Timer1.Enabled = False
Command1.Caption = "开始"
Me.Cls
Text1.Text = "请点击按钮开始"
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
End Sub
Private Sub Command1_Click()
Timer1.Enabled = Not Timer1.Enabled
Command1.Caption = IIf(Command1.Caption = "停止", "开始", "停止")
If Timer1.Enabled = False Then
Print Text1.Text
If cjnum = tper - 1 Then
groupname = Replace(groupname, "," & Text1.Text, "")
Else
groupname = Replace(groupname, Text1.Text & ",", "")
End If
If Trim(groupname) = "" Or InStr(groupname, ",") = 0 Then
Print groupname
MsgBox "本轮抽号已结束!"
groupname = "A,B,C,D,E,F,G,H,I"
Me.Cls
Text1.Text = "请点击按钮开始"
Else
Call getname
End If
End If
End Sub
Private Sub Timer1_Timer()
cjnum = Int(Rnd * tper)
Text1.Text = a(cjnum)
End Sub
Sub getname()
Dim xm
xm = Split(groupname, ",")
tper = UBound(xm) + 1
ReDim a(tper) As String
For i = 0 To tper - 1
a(i) = xm(i)
Next i
End Sub
在上述程序中,name.txt内文本为"A,B,C,D,E,F,G,H,I",那么如何让VB正常读取和运行软件呢? 展开
Dim a() As String
Dim i%, cjnum%, tper%, groupname$
Private Sub Form_Load()
groupname = "A,B,C,D,E,F,G,H,I"
Call getname
Timer1.Interval = 10
Timer1.Enabled = False
Command1.Caption = "开始"
Me.Cls
Text1.Text = "请点击按钮开始"
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
End Sub
Private Sub Command1_Click()
Timer1.Enabled = Not Timer1.Enabled
Command1.Caption = IIf(Command1.Caption = "停止", "开始", "停止")
If Timer1.Enabled = False Then
Print Text1.Text
If cjnum = tper - 1 Then
groupname = Replace(groupname, "," & Text1.Text, "")
Else
groupname = Replace(groupname, Text1.Text & ",", "")
End If
If Trim(groupname) = "" Or InStr(groupname, ",") = 0 Then
Print groupname
MsgBox "本轮抽号已结束!"
groupname = "A,B,C,D,E,F,G,H,I"
Me.Cls
Text1.Text = "请点击按钮开始"
Else
Call getname
End If
End If
End Sub
Private Sub Timer1_Timer()
cjnum = Int(Rnd * tper)
Text1.Text = a(cjnum)
End Sub
Sub getname()
Dim xm
xm = Split(groupname, ",")
tper = UBound(xm) + 1
ReDim a(tper) As String
For i = 0 To tper - 1
a(i) = xm(i)
Next i
End Sub
在上述程序中,name.txt内文本为"A,B,C,D,E,F,G,H,I",那么如何让VB正常读取和运行软件呢? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询