13
CONTROL ARRAYS MELJUN CORTES MELJUN CORTES

MELJUN CORTES Control array

Embed Size (px)

Citation preview

Page 1: MELJUN CORTES Control array

CONTROL ARRAYS

MELJUN CORTESMELJUN CORTES

Page 2: MELJUN CORTES Control array

Overview

Definition of Control Arrays Characteristics of Control Arrays Uses of Control Arrays How to create Control Arrays Example / Demonstration

Page 3: MELJUN CORTES Control array

is a group of controls of the same type that have the same name and share the same set of event procedure or provide similar functionality.

Definition of Control Arrays

Page 4: MELJUN CORTES Control array

Characteristics of Control Arrays

each control array element maintains its own properties

share its event procedure code with the other control array elements

have minimum lower bound of 0 and a maximum upper bound 32767

control array bounds are not affected by Option Base (unless the programmer specifies otherwise, 0 is always the lower bound

each control array element is uniquely identified by its Integer Index property

Page 5: MELJUN CORTES Control array

Uses of Control Arrays

to group together existing controls fewer resources than simply adding multiple controls of

the same type to a form at design time. useful if you want several controls to share code

Example: if three option buttons are created as a control array, the same code is executed regardless of which button was clicked

Page 6: MELJUN CORTES Control array

How to create Control Arrays?

By giving a control the same name as another control By copying a form’s control and pasting the copy on

the form Explicitly setting a control’s Index property

Page 7: MELJUN CORTES Control array

Control Array Dialog Box

Page 8: MELJUN CORTES Control array

Example

A government lab wants to install a security keypad outside a laboratory room. Only authorized personnel may enter the lab, using their security codes. The following are valid security codes:

1645 – 1689 = Technician Personnel

8345 = Custodial Services

55875 = Special Services

999898, 1000006 – 1000008 = Scientific Personnel

As an added security measure, the keypad treats any access less than 1000 as a panic code by sounding a single beep. Although access is denied, security is notified immediately. Once an access code is entered, access is either granted or denied. All access attempts are written to a window below the keypad. If access is granted, the date, time, and group (i.e., Technician Personnel, Custodial Services, etc.) are written to the window. If access is denied, the date, time and the message “Access Denied” are written to the window.

Page 9: MELJUN CORTES Control array

Example: Explained

True

True

True

Page 10: MELJUN CORTES Control array

Example: Sample GUI

Page 11: MELJUN CORTES Control array

Example: Explained (Case Multiple Selection Structure)

Page 12: MELJUN CORTES Control array

Example: Explained (Control Arrays)

Page 13: MELJUN CORTES Control array

Review

Definition of Control Arrays Characteristics of Control Arrays Uses of Control Arrays How to create Control Arrays