新手求教 vb里面逐行读取txt的数据,并和文本框输入数据进行验证,根据验证结果弹出框体
--------------------编程问答-------------------- 程序没有什么问题,只是打开文件要指明全路径,比如:Open App.Path & "use.txt" For Input As #1
注意你的那个文本文件中不要有多余的符号. --------------------编程问答-------------------- 无法,你程序写的逻辑有问题.
最简单的办法不是给你说怎么写,是你用F8单步调试你的程序,看看是不是你想要的执行顺序和逻辑 --------------------编程问答--------------------
Private Sub Command1_Click()
Dim a1 As String, a2 As String, a3 As String, n As Integer
Open App.Path & "/1.txt" For Input As #1
Do While Not EOF(1)
Input #1, a1, a2, a3
n = n + 1
If Text1.Text = a1 And Text2.Text = a2 And a3 = CStr(n) Then
Close #1
Form1.Hide
Form3.Show
Exit Sub 'ÑéÖ¤³É¹¦Í˳ö
End If
Loop
Close #1
MsgBox "password is not true!"
Text1.Text = ""
Text2.Text = ""
End Sub
补充:VB , 基础类