Guaranteed Hits to your web site!












Learn Visual Basic 6.0


3. Exploring the Visual Basic Toolbox


Control Arrays

  1. With some controls, it is very useful to define control arrays - it depends on the application. For example, option buttons are almost always grouped in control arrays.

  2. Control arrays are a convenient way to handle groups of controls that perform a similar function. All of 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.

  3. Another advantage to control arrays is that you can add or delete array elements at run-time. You cannot do that with controls (objects) not in arrays. Refer to the Load and Unload statements in on-line help for the proper way to add and delete control array elements at run-time.

  4. Two ways to create a control array:
  5. Once a control array has been created and named, elements of the array are referred to by their name and index. For example, to set the Caption property of element 6 of a label box array named lblExample, we would use:
    We'll use control arrays in the next example.


Pen Line


Counter Hit Counter Hit


This Homepage is special brought to you by CK Tan
Hosted by www.Geocities.ws

1