0% found this document useful (0 votes)
31 views2 pages

15ctrl Ary

Control arrays allow grouping of multiple controls of the same type into an array. Controls in the array must be the same type and be given the same name, with each control assigned a unique index number. Properties of individual controls can vary, but all controls share the same event procedures, with the index of the triggered control passed as a parameter.

Uploaded by

Thenmozhi Banan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views2 pages

15ctrl Ary

Control arrays allow grouping of multiple controls of the same type into an array. Controls in the array must be the same type and be given the same name, with each control assigned a unique index number. Properties of individual controls can vary, but all controls share the same event procedures, with the index of the triggered control passed as a parameter.

Uploaded by

Thenmozhi Banan
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Control Array

CONTROL ARRAYS

Similar to arrays of variables, you can group a set of controls together as an array. The following facts apply to control arrays:

The set of controls that form a control array must be all of the same type (all textboxes, all labels, all option buttons, etc.)

You set up a control array by naming one or more controls of the same type the same name and set the Index property of each control in the array to a non-negative value (i.e., the controls in the control array are usually indexed from 0 to one less than the number of controls in the array).

The properties of the controls in the control array can vary: i.e., some members can be visible or not, they can be sized differently, they can have different fonts or colors, etc.

To refer to a member of a control array, the syntax is:

ControlName(Index)[.Property]

For example, to refer to the Text property of the first element of an array of textboxes called txtField, you would use:

txtField(0).Text

All the members of the control array share the same event procedure for example, if you have a control array of 10 textboxes call txtField, indexed 0 to 9, you will not have 10 different GotFocus events you will just have one that is shared amongst the 10 members. To differentiate which member of the control array is being acted upon, VB will automatically pass an Index parameter to the event procedure.

You might also like