Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to create a form that only shows when app is loaded

Status
Not open for further replies.

Sprowler

IS-IT--Management
Sep 30, 2002
102
0
0
GB
Hello everyone. Hope you can help me.

I have developed an app that enables the user to opt to either login from a Login form, or bypass this and login with a specified username.

I want to create a form that when the application is first installed and run the form asks the user for their name, and whether or not they want to use the Login form or go straight in to the app. In other words, the the Startup form will create a new user and password in the Users table, and the user can opt to show or bypass the Login screen.

I have created a Project Setting called IsNew that is initially set to True and I tell the startup form to display if the value is True. When the user has entered the details, I want to set the IsNew setting to False to hide the form the next time. I can then save the other settings in the configuration file and if the user wants to use the login screen this shows otherwise the app logs the user in with the specified information.

In other words, I only want this form to display the first time the app is installed and then theSystem Settings entered on this form governs how the app behaves after that.

Can anyone help me to find the best way to achieve this?

Your help is greatly appreciated.
 
Hello, I use the following:
Code:
   Public Sub Main()
        'This module acts as the startup object
        Dim Admin As Boolean ' Flag used to control flow based on administration or not
        ' Forms to be shown
        Dim frmLogon As New frmLogin
        Dim frmLMods As New frmListModules
        Dim frmAdmin As New frmAdministration

        frmLogon.ShowDialog()
        Admin = frmLogon.chk_Administration.Checked
        frmLogon = Nothing ' Release frmLogon

        'The log on form sets LogOnOK to True if log on is ok
        If LogOnOK Then
            ' Is the admin screen or the module select screen wanted
            If Admin Then
                Application.Run(frmAdmin)
            Else
                Application.Run(frmLMods)
            End If
        End If
        frmAdmin.Dispose()
        frmLMods.Dispose()
        GC.Collect()
        End
    End Sub 'Main
and use the mod that holds this as the start object.

Hope this gives you some ideas
djj
 
Hi djj

Thanks for your prompt reply.

I'll look at your code over the next 2 days and will repost.

I'll give a star if it works.

Thanks again and have a nice weekend.

Sprowler
 
Sprowler, As an explination I needed to have a different form display if an admin was accessing the program and so I put a checkbox on the login form (Shown only to admins) that the module uses to populate Admin.
I would imagine you have some scheme for your user logon. If not there I would suggest using System.Environment.UserName.ToString
I had to put the "If LogOnOK Then" to handle the bad logon (wrong username/password).

Good luck,
djj
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top