Account System

  • Allgemein

Es gibt 5 Antworten in diesem Thema. Der letzte Beitrag () ist von Rinecamo.

    Account System

    Ja hey Leute ich mache gerade sowas wie ein Betriebssystem wo ich gerne ein Account System machen möchte
    Die Account Details sind dann in C:\ACCOUNTS so hätte ich das auch gernen nur das es halt funktioniert
    Kann mir jemand helfen????



    ich hatte schonmal einen Code der aber nicht gefunzt hat!

    VB.NET-Quellcode

    1. Public Class Form1
    2. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    3. If My.Computer.FileSystem.DirectoryExists("C:\ACCOUNTS") = True Then
    4. Else
    5. End If
    6. If TextBox1.Text = "" Then
    7. MsgBox("Error dein Account muss mindestens 1 Buchstaben haben!", MsgBoxStyle.Critical)
    8. Else
    9. MkDir("C:\ACCOUNTS" + TextBox1.Text)
    10. Dim username As New System.IO.StreamWriter("C:\ACCOUNTS" + TextBox1.Text + "\" + "username.txt")
    11. username.Write(TextBox1.Text)
    12. username.Close()
    13. Dim password As New System.IO.StreamWriter("C:\ACCOUNTS" + TextBox1.Text + "\" + "password.txt")
    14. password.Write(TextBox2.Text)
    15. password.Close()
    16. MsgBox("Account Erstellt", MsgBoxStyle.Information)
    17. End If
    18. End Sub
    19. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    20. If TextBox1.Text = "" Then
    21. MsgBox("Error, You Need at least one Letter", MsgBoxStyle.Critical)
    22. Else
    23. If My.Computer.FileSystem.DirectoryExists("C:\ACCOUNTS" + TextBox1.Text + "\") Then
    24. Dim USERREAD As System.IO.StreamReader = New System.IO.StreamReader("C:\ACCOUNTS" + TextBox1.Text + "USERNAME.TXT")
    25. Dim userline As String
    26. Dim PASSREAD As System.IO.StreamReader = New System.IO.StreamReader("C:\ACCOUNTS" + TextBox1.Text + "PASSWORD.TXT")
    27. Dim passline As String
    28. Do
    29. passline = TextBox2.Text
    30. userline = USERREAD.ReadLine
    31. Console.WriteLine(passline)
    32. Console.WriteLine(userline)
    33. Loop Until userline Is Nothing
    34. If TextBox2.Text = "" Then
    35. MsgBox("Error, Please Input a Password", MsgBoxStyle.Critical)
    36. Else
    37. If passline = PASSREAD.ReadLine() = True Then
    38. MsgBox("Wilkommen in BeLuX 2011 " + TextBox1.Text)
    39. End If
    40. End If
    41. Else
    42. MsgBox("Der Username existiert nicht!", MsgBoxStyle.Critical)
    43. End If
    44. End If
    45. End Sub
    46. End Class


    HILFE oder ein TUTORIAL wäre nett von euch!
    Also bei mir funktioniert dein Code.

    Versuchs mal so:

    Spoiler anzeigen

    VB.NET-Quellcode

    1. Public Class Form1
    2. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    3. If My.Computer.FileSystem.DirectoryExists("C:\ACCOUNTS") = True Then
    4. Else
    5. End If
    6. If TextBox1.Text = "" Then
    7. MsgBox("Error dein Account muss mindestens 1 Buchstaben haben!", MsgBoxStyle.Critical)
    8. Else
    9. MkDir("C:\ACCOUNTS\" + TextBox1.Text)
    10. Dim username As New System.IO.StreamWriter("C:\ACCOUNTS\" + TextBox1.Text + "\username.txt")
    11. username.Write(TextBox1.Text)
    12. username.Close()
    13. Dim password As New System.IO.StreamWriter("C:\ACCOUNTS\" + TextBox1.Text + "\password.txt")
    14. password.Write(TextBox2.Text)
    15. password.Close()
    16. MsgBox("Account Erstellt", MsgBoxStyle.Information)
    17. End If
    18. End Sub
    19. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    20. If TextBox1.Text = "" Then
    21. MsgBox("Error, You Need at least one Letter", MsgBoxStyle.Critical)
    22. Else
    23. If My.Computer.FileSystem.DirectoryExists("C:\ACCOUNTS\" + TextBox1.Text + "\") Then
    24. Dim USERREAD As System.IO.StreamReader = New System.IO.StreamReader("C:\ACCOUNTS\" + TextBox1.Text + "\USERNAME.TXT")
    25. Dim userline As String
    26. Dim PASSREAD As System.IO.StreamReader = New System.IO.StreamReader("C:\ACCOUNTS\" + TextBox1.Text + "\PASSWORD.TXT")
    27. Dim passline As String
    28. Do
    29. passline = TextBox2.Text
    30. userline = USERREAD.ReadLine
    31. Console.WriteLine(passline)
    32. Console.WriteLine(userline)
    33. Loop Until userline Is Nothing
    34. If TextBox2.Text = "" Then
    35. MsgBox("Error, Please Input a Password", MsgBoxStyle.Critical)
    36. Else
    37. If passline = PASSREAD.ReadLine() = True Then
    38. MsgBox("Wilkommen in BeLuX 2011 " + TextBox1.Text)
    39. End If
    40. End If
    41. Else
    42. MsgBox("Der Username existiert nicht!", MsgBoxStyle.Critical)
    43. End If
    44. End If
    45. End Sub
    46. End Class