
The Structure of a Visual Basic Program | 93
Program
Structure
This is the Title of the Book, eMatter Edition
Copyright © 2006 O’Reilly & Associates, Inc. All rights reserved.
New in 2005. The new Global keyword provides a way to resolve conflicts in
namespace usage. For instance, if your application included a namespace named
MyCompany.System, and you used the
Imports MyCompany statement in your code
file, would a reference to “System” mean the .NET-supplied System namespace or
the MyCompany.System namespace? The
Global keyword solves the problem. To
access the .NET-supplied System namespace, reference
Global.System, which
removes any ambiguity.
Types
Most of your application is defined through types: the classes, structures, enumer-
ations, interfaces, and so on, of your application. Many types can be nested.
Public Class ClassDepth1
Public Class ClassDepth2
' ----- Add code here.
End Class
' ----- And here, too.
End Class
Types contain members, mainly the methods, properties, events, and fields of
your classes and structures. Members cannot be nested, although members with
the same name may appear within different nested types. For instance, if Class
A
contains Class B, both A and B may include a procedure named ProcessData
without conflict.
The Structure of a Visual Basic Program
Broadly speaking, programs can be either procedure-driven or event-driven.Ina
procedure-driven program, program flow is