What I want to create is a system where the user is filling the registration form once everything is correct and he presses the button, the next form will appear with credit card details and the amount he wants to top up. The username and password is going to be stored in text file in format username|password|money. Then user can log into their account and add more balance.
By using jmcilhinney suggestion with a list (of strings) () read last and split the last line, and then insert the money. However, when user login to their account they have to top their account but this time, the login|password|money could at the very first line.
Could anyone would give a hint what would be the best way of implementing this system, I have registration part done I just need to get an idea of how to finish the rest. I would really appreciate any suggestions/ Thank you
Code:
Private Sub btnComplete_Click(sender As Object, e As EventArgs) Handles btnComplete.Click
Dim top As Short
Short.TryParse(cboTop.SelectedItem > -1, top)
Dim list As New List(Of String)()
Dim reader As StreamReader = New StreamReader("..\..\TextFile\users.txt", True)
Dim line As String
Dim readAmount As String()
line = reader.ReadLine()
Do While Not (line IsNot Nothing)
line = line.Trim
readAmount = line.Split("|")
For i As Integer = 0 To readAmount.Length - 1
If readAmount(i).Length > 0 Then
list.Add(readAmount(i).Trim.ToString)
End If
Next
line = reader.ReadLine()
Dim writer As StreamWriter = New StreamWriter("..\..\TextFile\users.txt", True)
writer.WriteLine
' Im stock here
Loop
End Sub