VB读取TXT并显示出来
例如我D盘有一个里面有数据的文本1.TXT我想做个按扭把里面的数据显示到TEXT1.TEXT里并可以修改内面的数据保存回1。TXT里...
例如我D盘有一个里面有数据的文本1.TXT
我想做个按扭把里面的数据显示到TEXT1.TEXT里 并可以修改内面的数据保存回1。TXT里 展开
我想做个按扭把里面的数据显示到TEXT1.TEXT里 并可以修改内面的数据保存回1。TXT里 展开
1个回答
展开全部
读
Private Sub Command1_Click()
Open "d:\1.txt" For Input As #1
Dim Lines As String
Dim NextLine As String
Dim i As Integer
Do While Not EOF(1)
On Error Resume Next
Line Input #1, NextLine
Lines = Lines & NextLine & Chr(13) & Chr(10)
Loop
Close #1
Text1.Text = Lines
End Sub
写
Private Sub Command2_Click()
Open "d:\1.txt" For Output As #1
Print #1, Text1.Text
Close #1
End Sub
Private Sub Command1_Click()
Open "d:\1.txt" For Input As #1
Dim Lines As String
Dim NextLine As String
Dim i As Integer
Do While Not EOF(1)
On Error Resume Next
Line Input #1, NextLine
Lines = Lines & NextLine & Chr(13) & Chr(10)
Loop
Close #1
Text1.Text = Lines
End Sub
写
Private Sub Command2_Click()
Open "d:\1.txt" For Output As #1
Print #1, Text1.Text
Close #1
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询