VB 如何读取 已经打开的一个TXT文件的某特定一行?
如何用读取已打开的*.txt文档中的某一行比如:functionReadSomeLine(LineN)...endfunction谢谢高手赐教!...
如何用读取已打开的*.txt文档中的某一行
比如:
function ReadSomeLine(LineN)
...
end function
谢谢高手赐教! 展开
比如:
function ReadSomeLine(LineN)
...
end function
谢谢高手赐教! 展开
1个回答
展开全部
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
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询