EmersonH.Com

Transforming Knowledge into Power

  • Increase font size
  • Default font size
  • Decrease font size
Home VB.Net 2008 Data Data Class

Data Class

E-mail Print

This is one of my favorite ways to handle data in a medium to large projects.  When you create a data class,  you can keep the data organized in a class.  If the data is commonly used in other projects.  You can reused the data class in those projects.  Below is a sample data class:


Public Class ClientClass
'Client Info
Private strSSN As String
Private strLastName As String
Private strFirstName As String
Private strAddress1 As String
Private strAddress2 As String
Private strCity As String
Private strState As String
Private strZipCode As String


Public Property SSN() As String
Get
Return strSSN
End Get
Set(ByVal value As String)
strSSN = value
End Set
End Property

Public Property LastName() As String
Get
Return strLastName
End Get
Set(ByVal value As String)
strLastName = value
End Set
End Property


Public Property FirstName() As String
Get
Return strFirstName
End Get
Set(ByVal value As String)
strFirstName = value
End Set
End Property



Public Property Address1() As String
Get
Return strAddress1
End Get
Set(ByVal value As String)
strAddress1 = value
End Set
End Property

Public Property Address2() As String
Get
Return strAddress2
End Get
Set(ByVal value As String)
strAddress2 = value
End Set
End Property

Public Property City() As String
Get
Return strCity
End Get
Set(ByVal value As String)
strCity = value
End Set
End Property

Public Property State() As String
Get
Return strState
End Get
Set(ByVal value As String)
strState = value
End Set
End Property

Public Property ZipCode() As String
Get
Return strZipCode
End Get
Set(ByVal value As String)
strZipCode = value
End Set
End Property


Public Sub New()
'This will run every time you create a new class.  You can put data connections here to set the values of the variables.


End Sub
End Function
End Class

Last Updated on Monday, 21 December 2009 17:39