VB 怎样将LABEL控件的文字保存到TXT中?

来源:百度知道 编辑:UC知道 时间:2024/07/03 01:35:31
如题~
我还有个问题,如果上面答不出,答下面都行。
怎样将LABEL控件中的文字保存或干什么的,退出后`下此进入都可以看见这些文字?
帮下忙~~

如果要楼主说的那个效果,那么要用INI文件才可以,但是很复杂,需要使用FSO,我给你个简单的

private sub label1_change()
Dim txtCont as string

txtcont=label1.caption

open app.path & "\Config.txt" for output as #1
print #1,txtcont
close #1
end sub

以上是保存设置的

下面是掉入设置的:

private sub form_load()

On error goto Error '设置错误处理

dim txtcont as string

open app.path & "\Config.txt" for input as #2

input #2,txtCont

close #2

label1.caption=txtcont

Error:
exit sub
end sub

这样就可以达到目的了

诺,下面是代码
Dim a As String
a = Label1.Caption
Open "c:\1.txt" For Output As #1
Print #1, a
Close #1
很简单的啊。上面的代码是保存lable1控件的文字到c:\1.txt文本文件中的
如果有不明白的到我的空间里面取留言
http://hi.baidu.com/bbkingsss我会为你详细解答