when a user logs in i want assign a particular form to him depending on the user name he entered. that means different forms for different users.im using oledbdataadapter to connect to sql. i will appreciate your help.thanks

you mean that when user finished login, user access
a form in accordance with the rules?

you mean that when user finished login, user access
a form in accordance with the rules?

yes

you must to have a main menu. u can add code in form login to disable sub menu agree with user role.
so when user finished login, user only chosen the sub menu or menu that user depending on.
ex :
Dim Menu As New Main_Menu
Menu.Show()
Menu.x.Enabled = False

x : menu or sub menu in main menu that u want to disable.

this my part project n have same like u. but i didn't use oledbdataadapter, just for comparison.

If cmbRole.SelectedIndex = 0 Then
                        If dtUser1.Rows(0).Item(0) = Trim(txtUserId.Text) Then 'checking user id
                            If dtUser2.Rows(0).Item(0) = Trim(txtPasw.Text) Then ' cheking password
                                If dtUser.Rows(0).Item("ID_ROLE") = 1 Then ' cheking role
                                    Dim menu As New Menu_Utama
                                    Menu.Show()
                                    Me.Dispose(False)
                                Else
                                    MsgBox("You not Admin")
                                End If
                            Else
                                MsgBox("Wrong password!!", MsgBoxStyle.Critical, "Password Error")
                            End If
                        Else
                            MsgBox("Your User Id is not valid", MsgBoxStyle.Critical, "Wrong User_Id")
                        End If
                    Else
                        If cmbRole.SelectedIndex = 1 Then
                            If dtUser1.Rows(0).Item(0) = Trim(txtUserId.Text) Then 'checking user id
                                If dtUser2.Rows(0).Item(0) = Trim(txtPasw.Text) Then ' cheking password
                                    If dtUser.Rows(0).Item("ID_ROLE") = 2 Then ' cheking role
                                        Dim menu As New Menu_Utama
                                        Menu.Show()
                                        Menu.mnUser.Enabled = False
                                        Menu.BarMenu.Buttons(6).Enabled = False
                                        Me.Dispose(False)
                                    Else
                                        MsgBox("You not Headmaster")
                                    End If
                                Else
                                    MsgBox("Wrong Password!!", MsgBoxStyle.Critical, "Password Error")
                                End If
                            Else
                                MsgBox("Your User Id is not valid", MsgBoxStyle.Critical, "Wrong User_Id")
                            End If
                        End If
                    End If

in my project, i have 2 user (Admin & Headmaster)
admin can utilize all menu or sub menu in Main Menu.
Headmaster have same like Admin but headmaster can't to use User Management (add or delete user).

ok.that is. hope this help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.