vb如何读取txt文本,并逐行显示在label里面 20
vb如何读取txt文本,并逐行显示在label里面。txt文件是4列,73行,请问如何让它逐行显示在label里面。和txt文件内容格式一致呢?求详细代码。谢谢。最好是可...
vb如何读取txt文本,并逐行显示在label里面。
txt文件是4列,73行,
请问如何让它逐行显示在label里面。和txt文件内容格式一致呢?
求详细代码。谢谢。
最好是可以在每一句代码后面写上作用....谢谢 展开
txt文件是4列,73行,
请问如何让它逐行显示在label里面。和txt文件内容格式一致呢?
求详细代码。谢谢。
最好是可以在每一句代码后面写上作用....谢谢 展开
1个回答
展开全部
Private a() As String
Private idx As Integer
Private Sub Command1_Click()
Dim i As Integer
ReDim Preserve a(0 To 0) As String
Open "c:\1.txt" For Input As #1
While Not EOF(1)
Line Input #1, a(i)
i = i + 1
ReDim Preserve a(0 To i) As String
Wend
Close #1
Timer1.Enabled = True
Timer1.Interval = 10000
idx = 0
Call Timer1_Timer
End Sub
Private Sub Timer1_Timer()
Label1.Caption = a(idx)
idx = idx + 1
If idx > UBound(a) Then
Timer1.Enabled = False
Timer1.Interval = 0
End If
End Sub
Private idx As Integer
Private Sub Command1_Click()
Dim i As Integer
ReDim Preserve a(0 To 0) As String
Open "c:\1.txt" For Input As #1
While Not EOF(1)
Line Input #1, a(i)
i = i + 1
ReDim Preserve a(0 To i) As String
Wend
Close #1
Timer1.Enabled = True
Timer1.Interval = 10000
idx = 0
Call Timer1_Timer
End Sub
Private Sub Timer1_Timer()
Label1.Caption = a(idx)
idx = idx + 1
If idx > UBound(a) Then
Timer1.Enabled = False
Timer1.Interval = 0
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询