Vb中text数值保存读取问题
如何将5个text中的数值保存到txt文件,并在下次开启form窗口时,自动从txt读取数值至对应的text。实际上就是做参数窗口。谢谢!...
如何将5个text中的数值保存到txt文件,并在下次开启form窗口时,自动从txt读取数值至对应的text。 实际上就是做参数窗口。谢谢!
展开
展开全部
百度 VB 读写文本。
Open 文件名(最好是含有详细路径) For Output As #1
Print #1, 内容(就是你的text1.text & text2.text & ......
Close
如
Open "d:\我保存的东西.txt" For Output As #1
Print #1, text1.text
Print #1, text2.text
Print #1, text3.text
......
Close
哦少了点东西
下次读的时候
Open 文件 For Input As #1
Line Input #1, a
text1.text = a
Line Input #1, a
text2.text = a
Line Input #1, a
text3.text = a
......
Close #1
Open 文件名(最好是含有详细路径) For Output As #1
Print #1, 内容(就是你的text1.text & text2.text & ......
Close
如
Open "d:\我保存的东西.txt" For Output As #1
Print #1, text1.text
Print #1, text2.text
Print #1, text3.text
......
Close
哦少了点东西
下次读的时候
Open 文件 For Input As #1
Line Input #1, a
text1.text = a
Line Input #1, a
text2.text = a
Line Input #1, a
text3.text = a
......
Close #1
展开全部
Private Sub Command1_Click()
Unload Me
End
End Sub
Private Sub Form_Load()
Dim s As String
Dim i As Integer
Open App.Path + "\config.txt" For Binary As #1
If LOF(1) = 0 Then Close (1): Exit Sub
Close (1)
Open App.Path + "\config.txt" For Input As #1
Do Until EOF(1)
Input #1, s
Text1(i) = s
i = i + 1
Loop
Close (1)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim i As Integer
Open App.Path + "\config.txt" For Output As #1
For i = 0 To 4
Print #1, Text1(i)
Next
Close (1)
End Sub
Unload Me
End
End Sub
Private Sub Form_Load()
Dim s As String
Dim i As Integer
Open App.Path + "\config.txt" For Binary As #1
If LOF(1) = 0 Then Close (1): Exit Sub
Close (1)
Open App.Path + "\config.txt" For Input As #1
Do Until EOF(1)
Input #1, s
Text1(i) = s
i = i + 1
Loop
Close (1)
End Sub
Private Sub Form_Unload(Cancel As Integer)
Dim i As Integer
Open App.Path + "\config.txt" For Output As #1
For i = 0 To 4
Print #1, Text1(i)
Next
Close (1)
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
这个使用vb读写ini文件就可以做到了。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询