VB 按行提取TXT提取后删除
一行行提取TXT里面的内容被提取后的行删除[如TXT里面是]------------123[完成后TXT里面是]--------23...
一行行提取TXT里面的内容 被提取后的行删除
[如TXT里面是]------------
1
2
3
[完成后TXT里面是]--------
2
3 展开
[如TXT里面是]------------
1
2
3
[完成后TXT里面是]--------
2
3 展开
3个回答
展开全部
Private Sub Form_Click()
dim a()
Open "path" For Input As #1
Do Until EOF(1)
n = n + 1
Loop
End If
Close #1
ReDim a(n)
Open "path" For Input As #1
For i = 1 To n
Line Input #1, a(i)
Next i
End If
Close #1
List1.AddItem a(1)
For i = 1 To n - 1
a(i) = a(i + 1)
Next i
Open "path" For Output As #1
If n > 1 Then
For i = 1 To n - 1
Print #1, a(i)
Next i
Else
Print #1,
End If
Close #1
End Sub
dim a()
Open "path" For Input As #1
Do Until EOF(1)
n = n + 1
Loop
End If
Close #1
ReDim a(n)
Open "path" For Input As #1
For i = 1 To n
Line Input #1, a(i)
Next i
End If
Close #1
List1.AddItem a(1)
For i = 1 To n - 1
a(i) = a(i + 1)
Next i
Open "path" For Output As #1
If n > 1 Then
For i = 1 To n - 1
Print #1, a(i)
Next i
Else
Print #1,
End If
Close #1
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
只有重写txt文件,没有能自动删除txt每行内容的语句。
重写txt文件不用说了吧- -
重写txt文件不用说了吧- -
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询