发布网友 发布时间:2022-04-23 17:53
共2个回答
热心网友 时间:2023-09-22 21:31
Public j As Integer
Dim A() As String
Dim tem As String
Private Sub CMD1_Click() '注意这里如果没有exit sub,责会出现captio不会变的,其实已经变过了
If CMD1.Caption = "开始" Then
CMD1.Caption = "停止"
Timer1.Enabled = True
Exit Sub
End If
If CMD1.Caption = "停止" Then
CMD1.Caption = "开始"
Timer1.Enabled = False
If tem <> "" Then
Text1.Text = tem
End If
End If
End Sub
Private Sub CMD2_Click()
Frame1.Visible = True
Text2.Visible = True
CMD3.Visible = True
CMD4.Visible = True
End Sub
Private Sub CMD3_Click()
Text2.Visible = False
CMD3.Visible = False
CMD4.Visible = False
tem = Text2.Text
End Sub
Private Sub CMD4_Click()
Text2.Text = ""
Text2.Visible = False
CMD3.Visible = False
CMD4.Visible = False
End Sub
Private Sub form_load()
Frame1.Visible = False
Text2.Visible = False
CMD3.Visible = False
CMD4.Visible = False
Timer1.Enabled = False
Timer1.Interval = 300
Open "C:\Documents and Settings\Administrator\桌面\新建 文本文档.txt" For Input As 1
Do Until EOF(1)
ReDim Preserve A(0 To I)
Input #1, A(I)
I = I + 1
Loop
Close #1
End Sub
Private Sub Timer1_Timer()
Text1.Text = A(j)
j = j + 1
If j = UBound(A) Then
j = 0
End If
End Sub
已经运行通过,不过事先你得在桌面建立一个文本文件,用来存储数据,呵呵
追问代码很详细追答你说的加快速度,这个很好解决,Private Sub form_load()
Frame1.Visible = False
Text2.Visible = False
CMD3.Visible = False
CMD4.Visible = False
Timer1.Enabled = False
Timer1.Interval = 300
Open "C:\Documents and Settings\Administrator\桌面\新建 文本文档.txt" For Input As 1
Do Until EOF(1)
ReDim Preserve A(0 To I)
Input #1, A(I)
I = I + 1
Loop
Close #1
End Sub
看到这段代码了吗?你把Timer1.Interval = 300
这句话改为Timer1.Interval = 10,这样速度就会灰常的快啦,呵呵呵。当然要赶快那就再改小点。呵呵,忘记告诉你了,文本框中的每个数据是勇逗号隔开的,就像1,2,3这样
热心网友 时间:2023-09-22 21:32
果断求HI……本人在线等分,如果不要第三个要求当场就可以给你写……