Botão-Registar Dim usr As String = TextBox1.Text Dim pass As String = TextBox2.Text If usr = "" Then MsgBox("Tens que escolher um username", MsgBoxStyle.Critical) Else If pass = "" Then MsgBox("tens que escolher uma password", MsgBoxStyle.Critical) Else If My.Computer.FileSystem.DirectoryExists("C:\login\" & usr) Then MsgBox("O username Já existe", MsgBoxStyle.Critical) Else If My.Computer.FileSystem.DirectoryExists("C:\login") = False Then MkDir("C:\login") End If MkDir("C:\login\" & usr) Dim escrever_pass As New System.IO.StreamWriter("C:\login\" & usr & "\pass.txt") escrever_pass.Write(pass) escrever_pass.Close() MsgBox("A suea conta foi criada!") End If End If End If End Sub
Botão-Login Dim usr As String = TextBox1.Text Dim pass As String = TextBox2.Text If usr = "" Then MsgBox("Tens que escolher um username", MsgBoxStyle.Critical) Else If pass = "" Then MsgBox("tens que escolher uma password", MsgBoxStyle.Critical) Else If My.Computer.FileSystem.DirectoryExists("C:\login\" & usr) = False Then MsgBox("O utilizador nao existe", MsgBoxStyle.Critical) Else Dim baixar_pass As String = My.Computer.FileSystem.ReadAllText("C:\login\" & usr & "\pass.txt") If pass = baixar_pass Then MsgBox("Entrou com suceso") Else MsgBox("a password esta incorrecta!", MsgBoxStyle.Critical) End If End If End If End If End Sub