The most important thing in Visual Basic is design of a class Module. Here is a simple design of a class moduel through one simple example.
Class module design for a simple class module having a class name Class1 and having two properties say Class1.Valuex and Class1.Valuey. Both these properties of class can store integer value.
Class module code
Dim X as Integer
Dim Y as Integer
For passing value from class to the class property
Property Get ValueX( ) as integer
ValueX = X
End Property
Property Get ValueY( ) as integer
ValueY = Y
End Property
For passing value to class Property
Property Let X (Byval v as Integer)
X = v
End Property
Property Let Y (Byval v as Integer)
Y = v
End Property
Design of a class module ends over here. For attaching the class to a form having two text boxes
Dim Classvalue as new class1
Classvalue.ValueX = val(Text1.text)
Classvalue.ValueY = val(Text2.text)
Concepts of class can be seen in the above examples as below :
Concept of Encapsulation
Internal complex code is hidden. Since you see that the class code is stored in a separate module. You can't see what is happening behind.
Inheritance
By giving statement 'Dim Classvalue as new class1' we are passing the properties of the class1 to Classvalue.