a said:
Dear programmer I don't understand the array can any one give very easy
example to understand the types of array ( I can use command button and
text
box)
Example
'Don't forget to write notes for me
' the next line will define the array.
Dim a(2) As String
' the next lines define the data of array
a(0) = "1"
a(1) = "2"
a(2) = "3"
And so on
Notes:
The array is very difficult please give me easy example
An array is a data structure containing multiple elements of the same type.
When storage for an array is allocated, space for a fixed number of elements
is allocated. Arrays can be one-dimensional (a list of of elements),
two-dimensional (a table of elements) or may even have three or more
dimensions. Each individual element can be accessed by providing a numeric
index or "subscript" for each dimension, so that the location of that
element in the array's storage space can be calculated.
In the simple case, the size or "bounds" of each dimension of the array are
defined when it is declared. It is also possible to declare an array with
dynamic bounds, and later use the ReDim statement to allocate or reallocate
the array with specific bounds.
The statement:
Dim a(2) As String
declare a as a one-dimensional array of String elements. By default, the
array's first and only dimension has a lower bound of 0 (because the lower
bound wasn't specified) and an upper bound of 2. Therefore there are three
elements in the array, and the individual elements can be referred to as
a(0), a(1), and a(2). In those references, the numbers in the parentheses
are the subscripts that identify the specific element in the array.
The array declaration above is equivalent to the statement
Dim a(0 To 2) As String
which declares both the lower bound and the upper bound.
A declaration like this:
Dim i(20, 20) As Integer
defines a two-dimensional array of Integer elements. As declared, unless an
Option Base statement had been used to set a different default low bound, it
would declare an array with 21 x 21 elements, making 441 in all, addressable
by references ranging from i(0, 0) to i(20, 20).
This declaration:
Dim i(1 To 20, 1 To 20) As Integer
declares an array with 400 elements, addressable by references from i(1,1)
to i(20, 20). For this array, a reference to i(0,0) would raise a
"subscript out of range" error.