展开全部
Private Sub Form_click()
Print ReadSomeLine("z:\1.txt", 3)
End Sub
Function ReadSomeLine(Str1 As String, LineN As Integer)
Dim temp As String
Dim a() As Variant, x As Integer
Open Str1 For Input As #1
Do While Not EOF(1)
Line Input #1, temp
ReDim Preserve a(x)
a(x) = temp
x = x + 1
Loop
Close #1
ReadSomeLine = a(LineN - 1)
End Function
Print ReadSomeLine("z:\1.txt", 3)
End Sub
Function ReadSomeLine(Str1 As String, LineN As Integer)
Dim temp As String
Dim a() As Variant, x As Integer
Open Str1 For Input As #1
Do While Not EOF(1)
Line Input #1, temp
ReDim Preserve a(x)
a(x) = temp
x = x + 1
Loop
Close #1
ReadSomeLine = a(LineN - 1)
End Function
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Dim b As String Private Sub Command1_Click() Open "E:\VB98\YXW\a.txt" For Input As #1 '#1里面的1指的是空闲文件号,必须,取值1~511 line input #1,b '这是读一行。也可以改成:input #1,b Text1.Text = b close #1 '关闭文件 End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询