I created this account just to ask this question XD.
So, I'm currently working on a school project. The project requires ONLY the use of Visual Basic. So, no MS Access or anything. (Maybe a few.. text files.)
The first few forms of my program shows a log-in screen, that uses the "If, Then, Else" for detecting the correct username and password.
I decided to add a feature to my program. It lets the user fill-up two textboxes(Username and Password), once that's done, the program writes the credentials into a text file. So now there are two, the Register Form and the Log-In Form. Here's my code on it, if that could help:
On the Log-In form, two textboxes(Username, Password) are placed. The program SHOULD use the value of the two text boxes, compare them to the lines of the text file(Maybe using Do While-Loop?), find a match and proceed to the program.
Now, I asked this same question on another forum. People who replied suggested something like splitting them into an array and ReadAllLines. But due to life problems, I wasn't able to test it out, I able to think of a code in my head, but not in a computer.
Btw, in my case, what's better? ReadAllLines or use some code to test each line?
Here's my INCOMPLETE code that I thought of.
In what way can I continue the code?
PS: I have Visual Basic 2010. If that would matter.
So, I'm currently working on a school project. The project requires ONLY the use of Visual Basic. So, no MS Access or anything. (Maybe a few.. text files.)
The first few forms of my program shows a log-in screen, that uses the "If, Then, Else" for detecting the correct username and password.
I decided to add a feature to my program. It lets the user fill-up two textboxes(Username and Password), once that's done, the program writes the credentials into a text file. So now there are two, the Register Form and the Log-In Form. Here's my code on it, if that could help:
VB.NET:
Dim file As System.IO.StreamWriter
file = My.Computer.FileSystem.OpenTextFileWriter("d:/users.txt", True)
file.WriteLine(TextBox1.Text + "," + TextBox2.Text)
file.Close()
MessageBox.Show("User Created")
Me.Hide()
frmLogin.Show()
On the Log-In form, two textboxes(Username, Password) are placed. The program SHOULD use the value of the two text boxes, compare them to the lines of the text file(Maybe using Do While-Loop?), find a match and proceed to the program.
Now, I asked this same question on another forum. People who replied suggested something like splitting them into an array and ReadAllLines. But due to life problems, I wasn't able to test it out, I able to think of a code in my head, but not in a computer.
Btw, in my case, what's better? ReadAllLines or use some code to test each line?
Here's my INCOMPLETE code that I thought of.
VB.NET:
Dim userpass As String
Dim filereader As System.IO.StreamReader
filereader = My.Computer.FileSystem.OpenTextFileReader("D:/users.txt")
Do While filereader.Peek() <> -1
userpass= filereader.ReadLine()
userpass.Split("","")
In what way can I continue the code?
PS: I have Visual Basic 2010. If that would matter.