EmersonH.Com

Transforming Knowledge into Power

  • Increase font size
  • Default font size
  • Decrease font size
Home VB 6 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:

 

Option Explicit
Private mstrClientSSN As String
Private mstrClientFName As String
Private mstrClientLName As String
Private mstrAddress1 As String
Private mstrAddress2 As String
Private mstrCity As String
Private mstrState As String
Private mstrZip As String



Property Let ClientFName(ByVal strClientFName As String)
mstrClientFName = strClientFName
End Property


Property Get ClientFName() As String
ClientFName = mstrClientFName
End Property


Property Let ClientLName(ByVal strClientLName As String)
mstrClientLName = strClientLName
End Property


Property Get ClientLName() As String
ClientLName = mstrClientLName
End Property


Property Let ClientSSN(ByVal strClientSSN As String)
mstrClientSSN = strClientSSN
End Property


Property Get ClientSSN() As String
ClientSSN = mstrClientSSN
End Property

Property Let Address1(ByVal strAddress1 As String)
mstrAddress1 = strAddress1
End Property


Property Get Address1() As String
Address1 = mstrAddress1
End Property


Property Let Address2(ByVal strAddress2 As String)
mstrAddress2 = strAddress2
End Property


Property Get Address2() As String
Address2 = mstrAddress2
End Property


Property Let City(ByVal strCity As String)
mstrCity = strCity
End Property


Property Get City() As String
City = mstrCity
End Property


Property Let State(ByVal strState As String)
mstrState = strState
End Property

Property Get State() As String
State = mstrState
End Property


Property Let Zip(ByVal strZip As String)
mstrZip = strZip
End Property


Property Get Zip() As String
Zip = mstrZip
End Property

Private Sub Class_Initialize()
'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

Last Updated on Monday, 21 December 2009 16:55