![](https://iknow-base.cdn.bcebos.com/lxb/notice.png)
描述:VB程序,进入程序,需要读取用户名和密码,用户名和密码保存在一个文件中,是进入程序后,
描述:VB程序,进入程序,需要读取用户名和密码,用户名和密码保存在一个文件中,是进入程序后,用text1和text2生成的,就是怎么进入程序时,判断文件是否存在,若存在,...
描述:VB程序,进入程序,需要读取用户名和密码,用户名和密码保存在一个文件中,是进入程序后,用text1和text2生成的,就是怎么进入程序时,判断文件是否存在,若存在,就爱读入两行分别为用户名和密码,不存在,就是text的默认值,还有点击确定按钮时,检查check1是否选中,若选中,则用text框的内容更新那个文件,求帮助,感谢!
展开
1个回答
展开全部
Dim username As String
Dim password As String
Private Sub Command1_Click()
If Check1.Value = vbChecked Then
Open App.Path & "\1.txt" For Output As #1
Print #1, username
Print #1, password
Close #1
End If
End Sub
Private Sub Form_Load()
If Dir(App.Path & "\1.txt") <> "" Then
Open App.Path & "\1.txt" For Input As #1
Line Input #1, username
Line Input #1, password
Close #1
Else
username = Text1.Text
password = Text2.Text
End If
End Sub
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询