Join us, let's discuss Web3, crypto and blockchain technology.

Declaring Arrays in vb.net

We could use Public or Dim statement to declare an array just as the way we declare a single variable.  

The Public statement declares an array that can be used throughout an application while the Dim  

statement declare an array that could be used only in a local procedure.  

The general format to declare an array is as follow:  

Dim arrayName(subs) as dataType  

where subs indicates the last subscript in the array.  

Example 13.1

Dim CusName(10) as String  

will declare an array that consists of 10 elements if the statement Option Base 1 appear in the declaration  

area, starting from CusName(1) to CusName(10). Otherwise, there will be 11 elements in the array  

starting from CusName(0) through to CusName(10)  

Example 13.2

Dim Count(100 to 500) as Integer  

declares an array that consists of the first element starting from Count(100) and ends at Count(500)



dp

Read next...

Mountains
Hivefirm
Hivefirm is a future focused community for all things Web 3 and crypto-related content

Follow us

Discover more of what matters to you