VB.NET 2005: Application Framework - Best Practice for Login Form

Posted on 2006-05-18
Last Modified: 2011-09-20
I am creating an application with a Login form. How I would have approached this with VB.NET 2003 is to have a Main Sub running that first displays the Login form, which does the validation and then go on to show the main application form.

Using the Application Framework in VB.NET 2005, I need a best practices approach on how to tackle the job.

Anyone care to pass on suggestions?


Question by:jsound
    LVL 85

    Accepted Solution


    Author Comment

    That's what I have implemented too, and your answer confirms the right approach. I completely agree with you to leave the application framework intact.

    I've taken the approach of sticking with the true OOP approach and encapsulate the success login state in the Login form. MyApplication_Startup code looks like this:

            Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup
                If My.Forms.LoginForm1.AuthenticationCancelled Then
                    e.Cancel = True
                End If
            End Sub

    This is just an example, but this allows me to check several 'states' (or property values in this case) to see which one applies.

    I appreciate your time and response!

    LVL 85

    Expert Comment

    by:Mike Tomlinson
    Yeah...that's definitely a little cleaner.  =)

    I keep forgetting that VB.Net 2005 allows you to work with the "default instance" of forms using just the form name like in the old VB6 days.

    Featured Post

    What Security Threats Are You Missing?

    Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

    Join & Write a Comment

    I think the Typed DataTable and Typed DataSet are very good options when working with data, but I don't like auto-generated code. First, I create an Abstract Class for my DataTables Common Code.  This class Inherits from DataTable. Also, it can …
    A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

    746 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

    16 Experts available now in Live!

    Get 1:1 Help Now