Some examples of using arrays in VB6

zhaozj2021-02-16  52

Some examples of using arrays in VB6

(1): Use of dynamic arrays

(1.1): First state the type of array

Syntax DIM A () AS Integer

(1.2): Define the subscript and the subscript when used

The syntax is REDIM A (1 to 5), indicating that the number of small standards is 1, and the lacque is 5.

(1.3): Assignment

For example

DIM I as integer

For i = 0 TO 5

A (i) = i

Next i

(1.4): Use of dynamic arrays

For example:

DIM J AS INTEGER

For j = 0 to 5

Me.List1.AddItem A (i)

NEXT J

Pay attention to reuse, do not reassign the bundle and subscript of the array

There are several points in the use of a dynamic array:

When the subscript and the subscript of the array must be assigned, the value is 0.

Such as:

DIM I as Interger

For i = 0 TO 5

Redim A (0 to 5)

A (i) = i

Next i

The value (0, 0, 0, 0, 0, 5) is unknown.

转载请注明原文地址:https://www.9cbs.com/read-22099.html

New Post(0)