Click here to Skip to main content
15,891,764 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello guys;

I'm developing a system in visual basic studio (vb net) and access database 2007.
I would like to know how I can make login form that will have 2 different users accessibility on system, all assign with different password and their service type.

I have two problems, I would like to know how I can use items that are stored in database in logintable, that will make login form work or open when they match with the items that are stored in access database.

My second problem or question, is how I make restriction to the second user to some menus items.

all the user has to access on the same page or form called LibrarySystemForm.
How can I make invisible or hide some items navigation menus in login form that are in LibrarySystemForm.


Here are the code I'm using in loginForm but they work independently.
VB
Imports System.Data.OleDb
Public Class loginform
    Dim con As New OleDb.OleDbConnection
    Dim da As OleDb.OleDbDataAdapter
    Dim cmd As OleDbCommand


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim dbprovider As String = "PROVIDER=Microsoft.ACE.OleDb.12.0;"
        Dim dbsource As String = "DATA SOURCE = CUULibDB.mdb.accdb"
        con.ConnectionString = dbprovider & dbsource
        
            con.Open()
           
    End Sub

   

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click

        Dim command As New OleDb.OleDbCommand
        Dim dataset As New DataSet

        If UsernameTextBox.Text = ("Librarian") And
           SerTypeComboBox.Text = ("Admin") And
           PasswordTextBox.Text = ("cavendish2013") And
           IdTextBox.Text = ("1") Or
           IdTextBox.Text = ("2") And
           SerTypeComboBox.Text = ("Assist") And
           UsernameTextBox.Text = ("Assistant") And
           PasswordTextBox.Text = ("cavendishlib") Then
            LibrarySystemForm.Show()
            Me.Hide()
        Else
            MessageBox.Show("Fail, try again")
        End If




    End Sub
  


End Class
Posted
Comments
TrushnaK 26-Jul-13 6:31am    
Why you not going with user rights...
and according to users rights show or hide the menus or panels.

1 solution

Well,the thing you are trying to implement can be called role management. Refer to below link where wonderful article is available regarding the same.It should be noted that some changes needs to be made.

Controls Based Security in a Windows Forms Application[^]

Regards..:laugh:
 
Share this answer
 
Comments
DAVID DUSHIMIMANA 26-Jul-13 7:46am    
Thank you Mr Rohn Leuva, if is possible to get that which use access database and vbnet it will be so great. ok

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900