What's New In VB5?
Want to see what is new in VB5?
Most of the information below is from the book "Doing Objects in Microsoft Visual Basic 5"
by Deborah Kurata (Ziff-Davis Press). All chapter references in
this excerpt are from that book.
Known Bugs/Issues
There have been some reported bugs and issues with VB5. Click here for a list of them.
If you find other bugs or issues with VB5, let us know and we
will post them. Click
here to email us.
Major New Features: Speed and the Web
Visual Basic 5 provides several major new features:
- Native compilation. A Visual Basic
application can be compiled to native code for faster
execution. See Chapter 10, "Building Your First
Class," for the details.
- Display speed. Improvements to the
internal control handling provide faster display of
Visual Basic screens.
- Creating ActiveX controls. You can now
create your own ActiveX controls with Visual Basic. You
can create a control and use it in any application that
supports ActiveX controls, such as VB4, VB5, and Web
pages. See Chapter 13, "Building ActiveX
Components," for more information.
- Creating ActiveX documents. Visual Basic
forms can be converted into ActiveX documents and
displayed in an Internet browser window, so you can
leverage your Visual Basic experience in the development
of Internet or intranet applications. See Chapter 13,
"Building ActiveX Components," for more
information.
- New Internet controls. Internet
Transfer, WebBrowser, and WinSock controls are provided
for easy browsing, transferring files, and exchanging
data with Web sites.
- Web-based deployment. The Setup Wizard
now has features to support Web-based deployment of your
components. See Chapter 13, "Building ActiveX
Components," for the details.
New Object-Oriented Features: More Reasons to Go OO
Many new Visual Basic 5 features are specifically for the
design and development of object-oriented applications:
- Multiple interfaces. You can define
multiple interfaces for classes in your applications.
Using multiple interfaces allows you to group the
properties and methods of a class into functional units,
reuse interfaces in other classes, and easily add
functionality to a class after the class has been
deployed. Chapter 12, "Interfaces, Polymorphism, and
Inheritance," lists the benefits of multiple
interfaces and describes how to create and use them.
- Improved polymorphism. To leverage
polymorphism in VB4, you have to give up early binding.
With VB5 you can use interfaces to attain early binding
when using polymorphism. Chapter 12, "Interfaces,
Polymorphism, and Inheritance," defines polymorphism
and explains why and how you would use it.
- Raising events. Visual Basic forms and
controls raise events and you can develop event
procedures to respond to those events. With VB5, classes
you create can raise their own events. Any class with a
reference to an object from the class can then respond to
the event. This feature allows an easier communication
mechanism between components in an application,
especially for asynchronous processing. See Chapter 10,
"Building Your First Class," for more
information on raising and responding to events.
- Global constants. You can now
encapsulate public constants for a class within a class
module using an enumeration. This approach is great for
listing the error numbers raised by the class and for
magic numbers required for modifying properties or
calling methods in the class. See Chapter 10,
"Building Your First Class," for more
information on declaring and using an enumeration.
- Improved Object Browser. The biggest
improvements to the Object Browser are the searching
capabilities and the modeless window. Additional
improvements make this an excellent tool for working with
your objects and the objects from other applications. See
Chapter 10, "Building Your First Class," for
more information on using the Object Browser.
- Improved debugging of classes. If you
have your Error Trapping set to Break in Class Module or
Break on All Errors and generate an error, you can now
press Alt+F8 to step into the error handler or Alt+F5 to
continue. See Chapter 10, "Building Your First
Class," for more information.
- *Better variable watching. You can drag
an object variable directly from the Code window to the
Watches window. The object and all of its properties will
then appear in the Watches window. All object variables
that are in scope at any particular time when running
your application will automatically appear in the Locals
window with their property values.
- Class documentation. You can develop
documentation for a class using the new Procedure
Attributes dialog box. See Chapter 10, "Building
Your First Class," for more information on this
dialog box.
- Default property or method. You can now
identify a property or method of a class to be the
default property or method. The default is the property
or method assumed if you use the object variable with no
property or method. For example, the Text property is the
default property for text boxes, so you can use txtName
instead of txtName.Text. Setting a default is
particularly useful for the Item method in a collection
class. See Chapter 11, "Building Classes: Additional
Techniques," for an example of setting a default
method.
- For Each
Next syntax for collection classes.
If you create a private collection and expose it with a
collection class in VB4, you can no longer use the For
Each
Next syntax on the private collection. VB5
exposes the enumerator object to provide this feature.
Chapter 11, "Building Classes: Additional
Techniques," provides the details of this process.
- Enhanced Property procedures. Property
procedures now allow variable arguments and typed
optional arguments. This improves the performance and
flexibility of Property procedures. See Chapter 14,
"Doing Database Objects," for an example.
- Global objects. You can convert your
function library or library of common routines into a
class in an ActiveX component and define the class to be
global. This feature allows developers to use the library
of functions without declaring an object variable or
creating an object. See Chapter 15, "Putting the
Pieces Together," for more information on global
objects.
- Friend methods. Classes in your ActiveX
component can now communicate privately without exposing
the classes to other applications. You can make this
happen by using the Friend keyword to declare the
procedure instead of using Public or Private. See Chapter
13, "Building ActiveX Components," for more
information. Friend methods also provide a mechanism to
pass user-defined types (UDTs) between classes. See
Chapter 10, "Building Your First Class," for
more information and an example of passing a UDT to a
class.
ActiveX Features: OLE Gets Active
There are a few other new ActiveX features in addition to
those already mentioned:
- OLE renamed. Many of the OLE features
from VB4 are renamed to ActiveX in VB5. The OLE servers
you created in VB4 are now ActiveX servers. See Chapter
13, "Building ActiveX Components," for more
information.
n Improved Version Compatibility. Testing ActiveX
components is easier with the new project compatibility
option. Chapter 13, "Building ActiveX
Components," describes the new Version Compatibility
settings.
- Modeless dialog boxes in an ActiveX DLL.
ActiveX DLLs no longer have the modal dialog box
restriction identified for VB4. See Chapter 13,
"Building ActiveX Components," for more
information.
- Multithreading. ActiveX components support
multithreading. Chapter 13, "Building
ActiveX Components," defines how the different types
of components provide multithreading.
New IDE Features: Cool Tools Rule!
The Visual Basic 5 integrated development environment (IDE)
provides many new productivity features and tools. These features
and tools by themselves are enough of a reason to move to VB5!
- Wizards. Wizards are provided in VB5 to
maximize your productivity. The VB Application Wizard can
complete the entire framework for your application, as
shown in Chapter 6, "User-Interface Design."
The VB Class Builder utility helps you to create your
entire object model and then automatically generates the
code for that object model. This process is outlined in
Chapter 11, "Building Classes: Additional
Techniques." *You can even have the Class Builder
utility add debug code to your classes.
Other Wizards build database maintenance screens, create
ActiveX control property pages, convert VB forms to
ActiveX documents, and much more.
- Templates. You can create any form,
module, class module, or any other type of project
component and copy it to a defined template directory.
The project component will then appear in the Add dialog
box, which makes it very easy to add the component to any
project. See Chapter 7, "Implementation-Centered
Design," for more information.
- Add Related Documents. You can add
documentation or other support files directly into the
project as related documents. You can also edit these
files from within the IDE. This makes it easy to keep
track of all of the associated documentation and support
files required for a project. Chapter 10, "Building
Your First Class," provides additional information
on using this feature to document your classes.
- Auto List Members. Visual Basic knows
the available properties and methods for every object.
Wouldnt it be nice if it could just provide you
with the list of valid properties and methods and let you
select one? With VB5 it does. This is such a timesaving
feature it is hard to imagine living without it.
- Auto Quick Info. This feature lists the
syntax for a statement or function after you enter the
statement or function name. This helps you enter the
correct set of parameters. For parameters that require a
constant, such as the Buttons parameter on the
MessageBox, the constants are listed for your selection.
- *Auto Completion. Use Ctrl + Space to
automatically complete any entered key word. For example,
type "msg" and then Ctrl + Space and
"msgbox" will be automatically completed for
you.
- Drag and drop of code. You can drag and
drop code anywhere within the IDE.
- Block and Unblock Comments. Using this
feature you can select a section of code and add or
remove comment markers from each line in the selection.
- Bookmarks. You can set bookmarks in the
code and return to the bookmark location. Chapter 11,
"Building Classes: Additional Techniques,"
describes how to use bookmarks and explains how to add a
shortcut key for bookmarks into the IDE.
- MDI or SDI style interface. Do you hate
seeing your other windows through the VB IDE or do you
love the way you can see your application with VB on top
of it? With VB5 you can select a multiple-document
interface (MDI) style or a single-document interface
(SDI) style for the IDE.
- Dockable windows. Any of the windows
within the IDE can be docked to create your desired
layout and Visual Basic will remember that layout.
- Project workspace files. When closing a
project, Visual Basic will store the location and size of
all open project windows, thereby saving your project
workspace. When you reopen the project, the project
workspace will be restored and all windows will be
displayed in their last location and size.
- Multiple Projects. You can define
multiple projects in a project group. You can then open
the group and all of the projects in the group will be
opened in the IDE. This is especially useful for
debugging ActiveX components. See Chapter 13,
"Building ActiveX Components," for more
information.
- Improved Project window. With the new
Project window, you can display all components of all
projects in a project group, sort components by type, and
access any project component, including additional files
such as documentation or support files.
- Multiple tabs on the toolbox. You can
add tabs to your toolbox so you can logically divide your
toolbox into sets of tools. This is very helpful if you
use a lot of third-party products or have developed many
of your own controls.
- Form Designer window. The Form Designer
window is a new window frame around your form. It
separates the form displayed to the user from the window
you use to create the form. Chapter 15, "Putting the
Pieces Together," provides more information on the
Form Designer window.
- New Form Layout Window. The new Form
Layout window allows you to visually identify at design
time the desired position for a form at run time. In
prior versions of Visual Basic, the form would appear in
the location defined when you edited the form, so if you
moved the form in the IDE, the form would appear in a new
location at run time. The Form Layout window allows you
to place the form anywhere inside or outside the screen
region independent of the location of the Form Designer
window at design time. The Form Layout window comes with
resolution guides to help you size or place windows for
640 x 480 or 800 x 600 resolutions. See Chapter 15,
"Putting the Pieces Together" for more
information on using the Form Layout window.
- Improved Properties window. The
Properties window now has two tabs. The Alphabetical tab
lists the properties in alphabetical order, as in prior
versions of Visual Basic. The Categorized tab lists the
properties by category. Using the categories is very
helpful for setting groups of properties, such as the
position properties. Chapter 14, "Doing Database
Objects," describes how this feature makes it easier
to set properties for bound controls.The Properties
window also provides a description of the currently
selected property at the bottom of the window. You can
toggle display of this description by right-clicking on
the Properties window and toggling the Description
option.
- Update Menu properties. The menu options
now appear in the Properties window so the menu
properties can be changed without using the Menu Editor.
See Chapter 15, "Putting the Pieces Together,"
for more information on this feature.
- *Update Project properties. The project
name now appears in the Properties window. Simply select
the project from the Project window and enter the project
name into the Properties window. You still need to go to
the Project Properties to set the description and other
project information.
- Separate Project options. The project
options are now separated from the editing and
environment options, making it easier to make appropriate
option selections. See Chapter 10, "Building Your
First Class", for a look at the new Project Options
and Options dialog boxes.
- Customizable Toolbar and Menu commands.
You can now customize your toolbar and menu commands.
Chapter 11, "Building Classes: Additional
Techniques," explains how.
- Instant Watch. When in break mode, you
can view the value of any variable or expression by
simply moving the cursor over the selection. See Chapter
11, "Building Classes: Additional Techniques,"
for more information.
- Improved Immediate window. With Visual
Basic 5, you can call routines, execute code, or create
objects from classes without first running and pausing
the project. Simply type the statements into the
Immediate window. See Chapter 11, "Building Classes:
Additional Techniques," for an example.
- *Drag and drop of execution marker. When
in break mode, the line to be executed next will appear
highlighted with a column marker (yellow circle). You can
drag the column marker to another location to define the
next line of code to be executed.
- Assert. The Debug object has a new
Assert method that checks the value of an expression and
stops execution of the application at design time if that
value is false. This allows you to verify the values of
expressions when developing and debugging an application.
See Chapter 11, "Building Classes: Additional
Techniques," for an example of using Assert.
Other New Features: An Assortment of Enhancements
Here are some other new features that are important to
mention:
- ODBCDirect. You can now access the RDO
libraries through the DAO object model using ODBCDirect.
See Chapter 8, "Data Design," and Chapter 14,
"Doing Database Objects," for more information.
- Access to the NT event log. VB5 added
several properties and methods to the App object to log
application events to a log file or directly to the NT
event log. Chapter 15, "Putting the Pieces
Together," provides a sample Error class that logs
events to the NT event log.
- AddressOf. Visual Basic can now pass a
function pointer to an API call. See Chapter 15,
"Putting the Pieces Together," for more
information.
- Typed optional arguments. In VB4
optional arguments had to be Variants, but with VB5 they
can be any data type. Using the specific data type for
optional arguments can improve performance because typed
arguments are faster to access than Variants. *NOTE: If
you use data types other than Variant, you cannot use the
IsMissing syntax. IsMissing is a type of Variant and will
not work on strings, integers, or other data types.
- OLE Drag and Drop. When this feature is
implemented in your application, the users can drag and
drop text between controls and between controls and other
applications such as Microsoft Word. See Chapter 15,
"Putting the Pieces Together," for more
information on this feature.
- ToolTipText property. A new ToolTipText
property on many of the controls displays a tooltip. See
Chapter 15, "Putting the Pieces Together," for
an example.
- New form properties. The new
StartUpPosition property defines the startup location of
a form at run time. There is also a new Moveable property
that locks a window in place and prevents the user from
moving it. Chapter 15, "Putting the Pieces
Together," provides more information on these
properties.
- Defining a window owner. A new parameter
on the Show method for a form allows you to specify an
owner form to establish a parent/child relationship
between the owner form and the form being shown. This
feature is described in Chapter 15, "Putting the
Pieces Together."
- DCOM. In addition to Remote Automation
provided in VB4, you can now remote your components using
the distributed component object model (DCOM). See
Chapter 13, "Building ActiveX Components," for
more information.
There are several additional new Enterprise Edition features
such as tools for debugging Transact-SQL and a built-in
Repository. See Craig Gorens book, "The Visual Basic 5
Enterprise", for information on the new Enterprise Edition
features.
*These are new things I found or heard about since the
original posting of this page.