7,763
社区成员
发帖
与我相关
我的任务
分享
Option Explicit
Dim phonestr As String '要显示的电话号码
Private Sub Command1_Click()
If Command1.Caption = "Start" Then
Command1.Caption = "Stop"
Timer1.Enabled = True
Else
Command1.Caption = "Start"
Timer1.Enabled = False
End If
End Sub
Private Sub Command2_Click()
Close #8 '关闭文件
End
End Sub
Private Sub Form_Load()
Label1.Caption = "中奖号码"
Command1.Caption = "Start"
Command2.Caption = "Quit"
Timer1.Interval = 100
Timer1.Enabled = False
Open "E:\lcf.txt" For Input As #8 '读取电话号码文件
End Sub
Private Sub Timer1_Timer()
Dim k As Integer
k = Rnd * 10 + 1 '文本中电话号码随机序号
If EOF(8) Then '滚动号码
Seek #8, k '设置随机读取位置
End If
Line Input #8, phonestr
Label1.Caption = phonestr
Label1.Refresh
End Sub
Private Sub Timer1_Timer()
Dim i As Integer
Do
i = Rnd * Combo1.ListCount
Loop Until i <> Combo1.ListIndex And i < Combo1.ListCount And Combo1.ItemData(i) = 0
Combo1.ListIndex = i
Combo1.ItemData(i) = 1
End Sub
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Command2_Click()
Timer1.Enabled = False
End Sub
Private Sub Form_Load()
Dim strLine As String
Open "yourfile.txt" For Input As #1
Do Until EOF(1)
Line Input #1, strLine
If strLine > "" Then Combo1.AddItem strLine
Loop
Timer1.Interval = 50
Timer1.Enabled = False
Randomize
End Sub
Private Sub Timer1_Timer()
Dim i As Integer
Do
i = Rnd * Combo1.ListCount
Loop Until i <> Combo1.ListIndex And i < Combo1.ListCount
Combo1.ListIndex = i
End Sub