Guaranteed Hits to your web site!












Learn Visual Basic 6.0


3. Exploring the Visual Basic Toolbox


Arrays

  1. Up to now, we've only worked with regular variables, each having its own unique name. Visual Basic has powerful facilities for handling multi-dimensional variables, or arrays. For now, we'll only use single, fixed-dimension arrays.

  2. Arrays are declared in a manner identical to that used for regular variables. For example, to declare an integer array named 'Items', with dimension 9, at the procedure level, we use:
    If we want the array variables to retain their value upon leaving a procedure, we use the keyword Static:
    At the form or module level, in the general declarations area of the Code window, use:
    And, at the module level, for a global declaration, use:
  3. The index on an array variable begins at 0 and ends at the dimensioned value. For example, the Items array in the above examples has ten elements, ranging from Items(0) to Items(9). You use array variables just like any other variable - just remember to include its name and its index. For example, to set Item(5) equal to 7, you simply write:


Pen Line


Counter Hit Counter Hit


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

1