Hi all,
I'm making a virtual OS, but I need some help with the login code.
This is what I have so far:
Code:
Public Class Login
    Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
        Label1.Visible = False
        Dim Test1 As String = UsernameTextBox.Text
        Dim Test2 As String = TextBox1.Text
        If AllUsers.Contains(Test1) Then
            If AllPasswords.Contains(Test2) Then
                'ADD LOGIN
                MsgBox("works")
            End If
        Else
            Label1.Visible = True
        End If
    End Sub

    Private Sub Login_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim file As New System.IO.StreamReader("Users.txt")
        Dim Length As Integer = file.ReadLine()
        Dim Users(Length) As String
        For i = 0 To Length - 1
            Users(i) = file.ReadLine()
        Next
        AllUsers = Users.ToString()
        file.Close()
        Dim file1 As New System.IO.StreamReader("x86VarServerX10.txt")
        Dim L2 As Integer = file1.ReadLine()
        Dim Passwords(L2) As String
        For i = 0 To L2 - 1
            Passwords(i) = file1.ReadLine()
        Next
        MsgBox(Passwords)
        MsgBox(Users)
    End Sub
End Class
My problem(s) are that the arrays are getting an extra value ;eg length = 3 instead of 2 (which is specified in the text files), so I end up with a 3rd value "Nothing". This is bad because someone could login without a user/password.

My other problem is that the arrays error in the msgbox. Using ToString() results in "System.String[]". How can I fix this?