vb logo

 

Visual Basic Books
Home
Visual Basic Beginner Books
Visual Basic Database Books
Visual Basic ActiveX Books
Visual Basic Advanced Books
VB Internet Programming Books

Resources
Free Online Visual Basic Courses
Visual Basic Links
Add a Link
Subscribe to Mailing List

Visual Basic Books

Programming Components with Microsoft Visual Basic 6.0

Creating
ActiveX Controls

The purpose of this exercise is to observe that ActiveX controls are alive from the moment the UserControl designer is closed. This action implicitly puts controls in the running state necessary to enable a developer to work with them. UserControl objects actually run in two modes: in Visual Basic’s design mode when software is being developed, and as part of another program at run time. Many Visual Basic programmers (not you, gentle reader) put a control on a form and thereafter erroneously think of the control as a permanent fixture of the form. By observing the Terminate and Initialize events as they occur in this exercise, you can see that the ActiveX controls are continually being created and destroyed in the Visual Basic environment.

Intrinsic Controls

Visual Basic comes with a bouquet of built-in controls. These are now called intrinsic controls to differentiate them from other types of controls, such as custom-built ones. The intrinsic controls are: CheckBox, ComboBox, CommandButton, Data, DirListBox, DriveListBox, FileListBox, Frame, HScrollBar, Image, Label, Line, ListBox, OptionButton, PictureBox, Shape, TextBox, Timer, and VScrollBar.

Properties

Now let’s turn our attention to properties. Visual Basic has three basic categories of control properties: ambient, extender, and custom. Ambient properties provide your control with information about the state of its container. Extender properties are those that seem to be part of your control but that are actually provided at run time by the container. Custom properties are ones that you implement entirely on your own.

It might initially seem surprising that there is such a variety in types of properties. Most developers who write applications in Visual Basic think of the properties that appear in the Properties window as belonging to a control. In fact, other properties not displayed in the Properties window exist, and of the properties displayed, some do not belong to the control. Consider the Top and Left properties of a control. They describe where the control is situated within the container. These types of properties belong to the container rather than the control, even though they appear in the Properties window.

Ambient Properties

The container provides ambient properties, and you can think of these properties as providing your control with information regarding its current environment. In fact, ambient properties are exposed by the client site in which the control is embedded, and they reflect values that the container wants to com municate to the control so that the control will take on the characteristics of the form in which it lives. These are, effectively, hints about how the control can best display itself in the container. Think of a chameleon that camouflages itself by changing color to match its surroundings. The purpose of ambient properties is to help your control camouflage that it is not really a native part of its container.

next page....
Email us your comments:mail
Fax: 1(916)404-7719
©1999 Valassis Enterprises. All rights reserved.