Você está na página 1de 21

Basic ActiveX Controls

Basic ActiveX Controls


 TextBox Control
 ListBox Control
 The ComboBox Control
 ScrollBar Control
 Slider Control
 The File Controls
Basic Properties: TextBox Control
Properties Description
MultiLine It determines whether the TextBox control will
hold a single line or multiple lines of text.
By default, the control holds a single line of
text. To change this behavior, set the MultiLine
property to True.
ScrollBars It controls the attachment of scroll bars to the
TextBox control if the text exceeds the
control’s dimensions. Single line TextBoxes can
have a horizontal scroll bar and MultiLine
TextBoxes can have a horizontal or vertical
scrollbars or both.
MaxLength It determines the number of characters the
TextBox control will accept. Its default value is
0, which means the text may be of any length
up to the control’s capacity length.(255
Basic Properties: TextBox Control
(Contd.)
Properties Description
Text It holds the control’s text. This property is
also available at design time so that we can
assign some initial text to the control. At run
time, we use this property to extract the
text entered by the user or to replace the
existing text by assigning a new value to the
Text property.
PasswordChar It turns the characters typed into any
character we specify.
Basic Properties: ListBox and
ComboBox Control
 MultiSelect: - It determines how the user
can select the list’s items and must be set at
design time. This property has the following
values: -
Setting Description
0 Multiple selection Not Allowed ; the default.

1 Simple multiple selection. A mouse click select or


deselect an item in the list. To move the focus of
another we have to press the arrow key.
2 Extended multiple selection. Press shift and click
the mouse (or press one of the arrow keys) to
span the selection. Press Control and click the
mouse to select or deselect an item in the list.
Basic Properties: ListBox and
ComboBox Control (Contd.)
 Sorted: - If we want the items,
inserted into a ListBox or ComboBox
control, to be always sorted, We
have to set the control’s sorted
property to True. This property must
be set at design time and is read-
only at runtime.
Basic Properties: ListBox Control

 Style: - The value of this property


can be either 0(standard) or
1(checkbox).
Basic Properties: ComboBox
Control
 Style: - This property of the ComboBox
control canm have the following values: -
Value Description

0 Default DropDown Combo i.e. the combo is made up of a


drop-down list and a text box. The user can select an item
from the list or type a new one.

1 Simple Combo i.e. it includes a textbox and a list that


doesn’t dropdown. The user can select from the list or
type anew one.

2 DropDown List i.e. it is a dropdown list from which the


user can select one of its items or can select a new one.
The ListBox Control’s Methods
 Operations that can be performed on
a ListBox are: -
- Add items to the list.
- Remove items from the list
- Access individual items in the list.
The ListBox Control’s Methods
(contd.)
 AddItem Method: -
This method is used to add items to
the list.
General Syntax: -
List1.AddItem item, index
•item parameter is the string to be added to the list, and
index is its order.
•The first item’s order is zero.
•The index argument is optional; if we omit it, the string is
appended to the bottom of the list.
The ListBox Control’s Methods
(contd.)
 Remove Item: - It is used to remove
an item from the list.
 We must find first the position (index)
in the list.
 General syntax: -
List1.RemoveItem index
•The index is the order of the item to be removed.
•This index parameter is not optional in the case.
The ListBox Control’s Methods
(contd.)
 Clear Method: - It removes all items
from the control.
 General syntax: -
List1.Clear
The ListBox Control’s Methods
(contd.)
 ListCount Method: - This is the
number of items in the list. The
items in the list can be accessed with
an Index value, which goes from 0 to
ListCount-1.
 List(): - This is an array that holds
the list’s items. The element List(0)
holds the first element of the list,
List(1) holds the second item, and so
on (upto List(ListCount-1).
The ListBox Control’s Methods
(contd.)
 ListIndex: - This is the index of the
selected item in the List. If multiple
items are selected, then ListIndex is
the index of the most recently
selected item.
 General Syntax: -
List1.RemoveItem List1.ListIndex
The ListBox Control’s Methods
(contd.)
 Selected: - This property is an arra,
similar to the List property, with
elements that have a True or false
value, depending on the status of the
corresponding list element.
 SelCount: - This property reports the
number of selected items in a
ListBox control with its MultiSelect
Property set to 1(simple) or
2(Extended).
The ListBox Control’s Methods
(contd.)
 NewIndex: - It returns the index of the
item most recently added to a ListBox
Control.
The ScrollBar Control and Slider
Control
 It is similar to the ScrollBar control, but
it doesn’t cover a continuous range of
values. The slider control has a fixed
number of tick marks, which the
developer can label.
 Right Click on ToolBox->Components->
Microsoft Windows Common Control 6.0.
 This will add a number of common
controls in the toolbox including the
slider Control.
The Slider Control
Basic Properties: -The Scrollbar
Control
 Min: - The Control’s minimum value.
 Max: - The control’s maximum value.
 Value: - The control’s current value,
specified by the indicator’s position.
The Scrollbar Control’s Events
 By clicking two arrows at its ends. The
value of the control changes by the amount
specified with the smallchange property.
 By clicking the area between the indicator
and the arrows. The value of the control
changes by the amount specified with the
largechange property.
 By scrolling the indicator with the mouse.
 Change: - This event occurs every time the
user changes the indicator’s position and
releases the mouse button. While the
indicator is being moved, this event isn’t
triggered.
The Scrollbar Control’s Events
(Contd.)
 Scroll: - It occurs continuously while
the indicator is moving.

Você também pode gostar