描述:VB程序,进入程序,需要读取用户名和密码,用户名和密码保存在一个文件中,是进入程序后,

2024-11-25 21:40:10
推荐回答(1个)
回答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