Variable Scope

  • Thread starter Thread starter Neil Steventon
  • Start date Start date
N

Neil Steventon

Hi ,

I have just started to move top vb.net from access, I was wondering am I right in saying if i create a login form and then set variables held in a class such as ;

Public Class clsGlobals

#Region "LoginDetails"

Public Shared username As String

Public Shared password As String

#End Region

End Class

is this the best way ?

I then use these variables in the whole project where I have to connect to any database. Is this the best way? , or what is the best way of keeping login details or any other data that needs to be passed from one form to another.

Thanks

Neil
 
* "Neil Steventon said:
I have just started to move top vb.net from access, I was wondering am I right in saying if i create a login form and then set
variables held in a class such as ;

Public Class clsGlobals
#Region "LoginDetails"
Public Shared username As String
Public Shared password As String
#End Region
End Class

is this the best way ?

Let's say it's one of multiple ways. It will work if not more than one
person can be logged in.
 
Hi,

Any Public variable in a module is available through out the entire project.

Ken
--------------------
Hi ,

I have just started to move top vb.net from access, I was wondering am I right in saying if i create a login form and then set variables held in a class such as ;

Public Class clsGlobals

#Region "LoginDetails"

Public Shared username As String

Public Shared password As String

#End Region

End Class

is this the best way ?

I then use these variables in the whole project where I have to connect to any database. Is this the best way? , or what is the best way of keeping login details or any other data that needs to be passed from one form to another.

Thanks

Neil
 
Back
Top