Home > Software engineering >  How to use VB simulated bank ATM
How to use VB simulated bank ATM

Time:09-24

 Option Explicit 

Dim As Single b

Private Sub Command1_Click ()
Dim a, s, n %
"C: \ 1. TXT" Open For Input As # 1
The Do While Not EOF (1)
The Line Input # 1, s
A=Split (Trim (s), "")
If Text1. Text=a (0) And Text2. Text=a (2) Then
Loop
Form1. Hide
The Load Form2
Form2. Show
The Else
MsgBox "password error! Please input again!"
Text2. Text=""
If b=2 Then
MsgBox "sorry wrong password to lose three times after the bank automatic swallowing card!"
Command1. Enabled=False
Command2. Enabled=False

End the If
End the If

B=b + 1


End Sub


I don't really know how to change the LOOP and I don't know where is the user password for now and can't get into

CodePudding user response:

A=Split (Trim (s), "")
Trim (s) have already put in the string s Spaces all cleared, can also detect the Spaces?

CodePudding user response:

 Option Explicit 
Dim As Single b

Private Sub Command1_Click ()
Dim a () As String, s As String, success As a Boolean

"C: \ 1. TXT" Open For Input As # 1
Do Until EOF (1)
The Line Input # 1, s
A=Split (Trim (s), "")
If Text1. Text=a (0) And Text2. Text=a (2) Then
Success=True
The Exit Do
End the If
Loop
Close # 1

If success Then
B=0
Form1. Hide
The Load Form2
Form2. Show
The Else
B=b + 1
If b=3 Then
MsgBox "sorry wrong password to lose three times after the bank automatic swallowing card!"
Command1. Enabled=False
Command2. Enabled=False
The Else
MsgBox "password error! Please input again!"
Text2. Text=""
End the If
End the If
End Sub

CodePudding user response:

reference 1st floor u013249970 response:
a=Split (Trim (s), "")
Trim (s) have already put in the string s Spaces all cleared, can also detect the Spaces?
Trim can "break off both ends."

CodePudding user response:

Could spit money,

CodePudding user response:

 Dim As Single b 

Private Sub Command1_Click ()
Dim a, s, S1, n %
Open the App. The Path & amp; "\ 1. TXT" For Input As # 1
The Do While Not EOF (1)
Line Input # 1, S1 'if there are more lines in the text file, need to deal with this if you only have a Line, don't need to DO cycle,
S=s & amp; Space (1) & amp; S1 'will be all content stored in the variable s
Loop
Close # 1
A=Split (Trim (s), "") 'storage array here
If Text1. Text=a (0) And Text2. The Text name=a (2) Then 'correct password
Unload Form1 'close Form1 interface, and cleared from memory
Form2. Show 'open interface Form2
The Else
MsgBox "password error! Please input again!"
Text2. Text=""
If b=2 Then
MsgBox "sorry wrong password to lose three times after the bank automatic swallowing card!"
Command1. Enabled=False
Command2. Enabled=False
End the If
End the If
B=b + 1
End Sub

I debugging, this is no problem,
  • Related