Creating Your Own Data Types
In Visual Basic you
can also create your own types of data by combining the basic types of
data. Situation: You are working on this program that needs to store
students in a database. Each student must have a Name, Age, Class.
Problem: How will I
can store this information in one single variable ?
Answer: it’s very simple create your own data type that will store
all this information:
We will do this using the Type statement
You must declare it
in the declaration section af a module, or form (if you are declaring
it in a form you must specify the Private keyword before the
variables as your defined type.
Dim [variable name] As Student
Dim Student As Students
members. After the variable is declared you can tread it as an object: