Hi, I'm currently doing a Holiday Booking System for my A Level Assessment.
The Form is fully functional but there's an error which I am unsure on how to fix as I am not completely advanced at Visual Basic.
![Name: Screenshot_5.jpg
Views: 34
Size: 26.2 KB]()
As you can see I have successfully logged in, although the error message for an incorrect username or password is still appearing. Just to mention the username's and password's are attached to a .txt file, whether this has an impact on that, I'm unsure
Above is the code I have for this part of the login. Is someone able to help me in correcting this? If not then no worries.
I also apologise if I have posted this to the wrong section of the forum, but I am new.
Thank you and Have a nice day :)
The Form is fully functional but there's an error which I am unsure on how to fix as I am not completely advanced at Visual Basic.
As you can see I have successfully logged in, although the error message for an incorrect username or password is still appearing. Just to mention the username's and password's are attached to a .txt file, whether this has an impact on that, I'm unsure
Code:
Private Sub BtnLogin_Click(sender As Object, e As EventArgs) Handles btnLogin.Click
'Opens Accounts File
FileOpen(1, "Accounts.txt", OpenMode.Random,,, Len(strLogin))
Do While Not EOF(1)
FileGet(1, strLogin,)
'Allow acess if Username and Password are Matched and Correct
If Trim(strLogin.Username) = txtUsername.Text And Trim(strLogin.Password) = txtPassword.Text Then
MainMenu.Show()
txtUsername.Clear()
txtPassword.Clear()
Me.Hide()
End If
Loop
If Trim(strLogin.Username) IsNot txtUsername.Text Or Trim(strLogin.Password) IsNot txtPassword.Text Then
MessageBox.Show("Username or Password are incorrect.")
End If
FileClose(1)
End Sub
I also apologise if I have posted this to the wrong section of the forum, but I am new.
Thank you and Have a nice day :)