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?

Thanks,

JB
jsoundAsked:
Who is Participating?
 
Mike TomlinsonMiddle School Assistant TeacherCommented:
0
 
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
            My.Forms.LoginForm1.ShowDialog()
            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!

JB
0
 
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.