Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27508

Multi Account System

$
0
0
I have been attempting to make a multi-account system in VB.NET. I have only seen how to do this via a database, but I need to use My.Settings or some other form as Mono on linux does not support using a database. Any ideas? I have attempted with My.Settings by using a Specialized String collection and storing the password/username as: "Username,Password" Where I then tried splitting it to get the data, but it didn't work. Any ideas?

EDIT: I wasn't specific enough sorry. First of all, I am just assuming Mono does not support using databases because any application using a database would not run, and MoMa said there was errors when using a database. On the splitting of the string in the settings, what I did was I (as stated above) stored the data as "Username,Password" and, if I had several, loaded it into a textbox (hidden) where I then had a for statement that would check the text (which was not split in the textbox, still listed as "Username,Password") which was then split and compared to the password and username the user inputted. Here is the code for checking the passwords, it only checks the first item of the textbox however (thats the issue):

Code:

Dim lname As String
    Dim lpass As String
    Dim lrank As Boolean

    For Each strLine As String In System_Login_Aid.TextBox1.Text.Split(vbNewLine)

            lrank = True
            lname = strLine.Split({"""", ","}, StringSplitOptions.None)(1)
            lpass = strLine.Split({",", """"}, StringSplitOptions.None)(2)

            If lname = usrname And lpass = usrpass Then
                Exit For
                Notify("Login Successful!", 1, "Successful")
            Else
                Notify("Error", 0, "Error")
            End If
        End If
    Next


    For i = 0 To System_Login_Aid.ListBox1.Items.Count - 1

        Dim string1 As String = System_Login_Aid.ListBox1.Items.Item(i)

        If string1.StartsWith("A") Then ' If the account has administrative privileges



            My.Settings.Usr_Rank = True
            My.Settings.Usr_Name = string1.Split({"""", ","}, StringSplitOptions.None)(1)
            My.Settings.Usr_Pass = string1.Split({",", """"}, StringSplitOptions.None)(2)
            If My.Settings.Usr_Name = usrname And My.Settings.Usr_Pass = usrpass Then
                'ClearUserAccounts()
                MsgBox(lname + " " + lpass)
                'LoginUser()
            Else
                Notify("Invalid password or username!", 6, "Error")
            End If


    Next


Viewing all articles
Browse latest Browse all 27508

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>