I am not 100% sure how public properties are supposed to be used but I intend to use it to store the current user’s name and email. It could also be used to store blog information momentarily.
Private mstrName As String
Public Property Name() As String
Get
Name = mstrName
' Returns default value if nothing has changed it
End Get
Set(ByVal pstrName As String)
mstrName = pstrName
'Sets the name to be the newly entered value
End Set
End Property
The information can then be retrieved or set as follows:
Dim settingsClass As New 'yourClassName' Response.Write(settingsClass.Name) 'Returns Cesar settingsClass.Name = "John" 'Assigns 'John' to the name property Response.Write(settingsClass.Name) 'Returns John


Mon, Aug 11, 2008
ASP.NET, Code