Constructors

A constructor is a method you invoke to create a new instance of a class that is represented by the New keyword in Visual Basic. For example, if you have the following Contact class

image

you can then create a new instance of the Contact class as follows:

image

All the three preceding syntaxes are enabled, so you can use the one you prefer. (I use the second one for better readability.) In other words, creating an instance means giving life to a new copy of the object so that you can use it for your purposes, such as storing data or performing ...

Get Visual Basic 2010 Unleashed now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.