Chapter 3

Objects and Visual Basic

What's in this chapter?

Object-Oriented Terminology

Composition of an Object

Characteristics of Value Types versus Reference Types

Primitive Types

Commands: If Then, Else, Select Case

Common Value Types (Structures)

Common Reference Types (Classes)

XML literals

Parameter passing ByVal and ByRef

Variable scope

Working with Objects

Understanding Binding

Data type conversions

Creating Classes

Event Handling

Object-Oriented Programming

Wrox.com Code Downloads for this Chapter

The wrox.com code downloads for this chapter are found at www.wrox.com/remtitle.cgi?isbn=9781118314456 on the Download Code tab. The code is in the chapter 3 download and individually named according to the code filenames throughout the chapter.

This chapter takes you through the basic syntax of Visual Basic. With its transition many years ago to .NET, Visual Basic like all native .NET languages, became an object-oriented language. At the time this was a major transition, and even now you continue to talk about how Visual Basic supports the four major defining concepts required for a language to be fully object-oriented:

1. Abstraction—Abstraction is merely the ability of a language to create “black box” code, to take a concept and create an abstract representation of that concept within a program. A Customer object, for instance, is an abstract representation of a real-world customer. A DataTable object is an abstract representation of a set of data.
2. Encapsulation—Encapsulation ...

Get Professional Visual Basic 2012 and .NET 4.5 Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.