[Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 413
  • Last Modified:

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

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?


  • 2
1 Solution
Mike TomlinsonMiddle School Assistant TeacherCommented:
jsoundAuthor Commented:
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!

Mike TomlinsonMiddle School Assistant TeacherCommented:
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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now