Académique Documents
Professionnel Documents
Culture Documents
Microsoft continually rolls out enhancements for its language products so that users
can take advantage of new features in its operating systems. It describes Visual Basic 6
as ready for Windows 2000. Concrete improvements in this version include new
database access tools and a high-performance native code compiler. The native code
compiler adds fast code execution to interactive development.
In addition to choosing a version, you must also decide which of three editions suits
your situation.
Visual Basic Learning Edition. This entry-level tool, targeted at hobbyist or novice
programmers, contains all the basic controls, such as buttons, grids, and text boxes, as
well as the all-important Microsoft Developer Network (MSDN) Library. The library
contains reams of articles and other references essential for developers.
Visual Basic Professional Edition. This edition of Visual Basic is considerably more
expensive, and its primarily for professional and corporate developers. It includes
additional components and tools aimed at database and Web development.
Visual Basic Enterprise Edition. This advanced edition, designed for teams of
multiple corporate developers, will probably cost you more than your mortgage
payment.
To get help in choosing the right edition, see Microsofts Visual Basic Web site
(http://msdn.microsoft.com/vbasic).
vaults. You cant understand the latter until youve mastered the former.
Language concepts. Unfortunately, there is not enough space in this article to cover
the full syntax of Visual Basic, but it is not particularly difficult to learn. People
familiar with programming in general should be able to get started immediately.
Conditional statements include a familiar, though wordy, if-this-then-this construct, as
well as a case statement for times when your program logic has to choose from
among more than two alternatives. The go-to and go-sub statements are remnants
of darker days for BASIC; most people avoid them today. Visual Basics four looping
constructs should be enough for anyones stylistic preferences.
Visual Basic also contains a stable full of built-in data types for storing values such as
numbers, characters, and strings. In this article, weve only scratched the surface of the
language concepts. Microsofts program documentation or a strong reference book
such as Pure Visual Basic by Dan Fox are good places to look for more details.
Application concepts. These concepts describe the basic building blocks of a Visual
Basic program, such as windows, forms, controls, classes, and modules. Programming
a Visual Basic application begins with creating the programs visual interface, which
you build by assembling forms and controls.
Windows play a central role in Microsofts modern operating systems. They provide a
foundation for interacting with users. Forms in Visual Basic are analogous to
windows. A form is an object with properties defining its appearance. It also has
methods defining its behavior as well as events defining the ways in which it interacts
with users. Visual Basic makes it easy to set a forms properties. And by writing Visual
Basic code to respond to events, it is relatively easy to customize the object for your
application.
Controls are user interface objects embedded into a form. A dialog box provides a
simple example. The dialog box itself is a form containing a number of controls such
as buttons, text, checkboxes, and input fields. Controls, like forms, have properties,
methods, and events, each suited to the particular type of control. For example, a
button responds to a click event, but a text-label control does not. By writing code
that responds to a click event, a Visual Basic programmer attaches the basic logic of
the program to its user interface.
Modules are the containers for Visual Basic code. The form, standard, and class
modules are common to all editions of Visual Basic. Form modules (using the .FRM
file extension) are the basis of most Visual Basic applications. Standard modules
(.BAS) are not associated with a particular form and can be reused in many
applications; as such, they are containers for generic declarations and procedures that
are useful beyond the scope of a single form. Class modules (.CLS) are the basis for
object-oriented programming in Visual Basic. The Professional and Enterprise editions
and see what methods and properties are available in your forms and controls, as well
as in other applications.
5. Step through your code. The debugging capabilities built into the Visual Basic
environment are the envy of programmers on other platforms. Learn them and use them
frequently.
6. Step through someone elses code. Run the sample code that comes with Visual
Basic. Studying someone elses code is a fast way to pick up programming ideas,
especially when theyre more experienced than you are.
7. Run your code often. Microsoft has gone to great lengths to make executing your
program fast within the IDE. Press the F5 key and test your program often.
8. Factor in common code. Take advantage of templates and standard modules to reuse a
single version of code rather than constantly duplicating it.
9. Buy rather than build. One of the most powerful aspects of Visual Basic is its vast
array of of-the-shelf components. Reduce your projects complexity by acquiring
functionality instead of building it yourself.
10. Keep yourself up to date. Visual Basic is a moving target. Its capabilities are always
growing and changing. Maintain the skills youve worked hard to develop and take
advantage of tutorials, newsgroups, FAQs (frequently asked questions), and other online
help.