Loading Diferent forms or projects depending on login.

Posted on 2009-04-28
Last Modified: 2013-11-26
RE: Visual Basic 2008
I need some advice.

I have a login form that determines the users group. Depending on the user and group the startup form or subforms may be differnt.

I tried to load different forms by Instantiating a string value saved to the users table.
   InstantiateThis += Staff.MainFormName.Trim
   frm = System.Activator.CreateInstance(Nothing, InstantiateThis).Unwrap()

Although this works, as design time I am unable to refer to the forms object as frm.object without a huge cluster of compied errors because I have to declare every single object.
Bottom line this does not save time !

So, I'm thinking of creating a new project (since they will be different) and having the login project determine which project to start.

 - How do I start another project within the solution ?
 - if the only way to start it is using a shell command then how can I read the projects installed location ?

Whatis Project Depensies used for ?

Does anyone have any advice on how to accomplish having different forms and modules loaded depending on the login name or group ?

Public Class Login

    Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click

        Select Case (Me.UsernameTextBox.Text).ToLower

            Case "simon"

                ' Load project called Claims

            Case "fred"

                ' Load project called pi

            Case "sam"

                ' Load project called Claims

            Case Else

                MsgBox("Username not valid", MsgBoxStyle.Exclamation, "Incorrect username")


        End Select

    End Sub

    Private Sub Cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cancel.Click


    End Sub

End Class

Open in new window

Question by:siacom
    LVL 18

    Accepted Solution

    If the projects will be different, then it is reasonable to put them in separate exe's. You can have one LogIn.exe that will allow user to choose the group, and based on the selected group you will launch a corresponding exe. As for getting projects installation paths, I guess it would be the best to write the path to some .txt file, which will be read by your logIn application. This file will contain a list of all installed projects.

    To run the application from LogIn application:



    Author Closing Comment

    Sweet, I'll try that way, thanks

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now