vb控件数据保存到text 按下按钮控件,保存text1.text 下次运行时,能读取保存的text 该怎么实现呢,
2个回答
展开全部
'窗体上添加两个按钮,点击按钮2让按钮1可见或不可见,每次点击后重新启动程序可观察效果
Dim s$ '定义全局配置设置
Private Sub Command2_Click()
If InStr(s, "c1v = 0") Then
s = Replace(s, "c1v = 0", "c1v = 1")
ElseIf InStr(s, "c1v = 1") Then
s = Replace(s, "c1v = 1", "c1v = 0")
Else
s = s & "c1v = 0" & vbCrLf
End If
Open App.Path & "\1.txt" For Output As #1
Print #1, s;
Close #1
End Sub
Private Sub Form_Load()
Dim strTxt$
If Dir(App.Path & "\1.txt") <> "" Then
Open App.Path & "\1.txt" For Input Access Read As #1
Do While Not EOF(1)
Line Input #1, strTxt
s = s & strTxt & vbCrLf
If strTxt = "c1v = 0" Then Command1.Visible = False
''''''还可以添加其它设置
Loop
Close #1
End If
End Sub
Dim s$ '定义全局配置设置
Private Sub Command2_Click()
If InStr(s, "c1v = 0") Then
s = Replace(s, "c1v = 0", "c1v = 1")
ElseIf InStr(s, "c1v = 1") Then
s = Replace(s, "c1v = 1", "c1v = 0")
Else
s = s & "c1v = 0" & vbCrLf
End If
Open App.Path & "\1.txt" For Output As #1
Print #1, s;
Close #1
End Sub
Private Sub Form_Load()
Dim strTxt$
If Dir(App.Path & "\1.txt") <> "" Then
Open App.Path & "\1.txt" For Input Access Read As #1
Do While Not EOF(1)
Line Input #1, strTxt
s = s & strTxt & vbCrLf
If strTxt = "c1v = 0" Then Command1.Visible = False
''''''还可以添加其它设置
Loop
Close #1
End If
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询