Control array

From HandWiki
Revision as of 18:27, 6 February 2024 by Steve Marsio (talk | contribs) (add)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

In simple array is a group of consecutive memory location with same name and typeVisual Basic, a control array[1] is a group of related controls in a Visual Basic form that share the same event handlers. Control arrays are always single-dimensional arrays, and controls can be added or deleted from control arrays at runtime. One application of control arrays is to hold menu items, as the shared event handler can be used for code common to all the menu items in the control array.[2] Control arrays are a convenient way to handle groups of controls that perform a similar function. All the events available to the single control are still available to the array of controls, the only difference being an argument indicating the index of the selected array element is passed to the event. Hence, instead of writing individual procedures for each control (i.e. not using control arrays), you only have to write one procedure for each array.

Control arrays are no longer supported in Visual Basic 2006, as "changes to the event model" made them unnecessary.[1] The Visual Basic Upgrade Wizard can convert code that uses control arrays into Visual Basic 2008 code that uses more recent structures.[3]

References

Template:Programming-software-stub