Student Mode Code Display

Welcome to the Fraternity!

Commenting has been enabled. You can comment on all the Code Items now.

Array to Store Multiple Data Type Values

Add This Code to My Favourite List
Enter Email

Contributed By Amit Kumar Shukla
Date 2014-03-01 10:16:53

'An array can store Multiple data types values

'Define an array
arr = Array("Akash",4)

'Define an Object
Set oFso = CreateObject("Scripting.FileSystemObject")

'Define main array
Dim arrMain(4)

arrMain(0) = 1 ' storing an Integer
arrMain(1) ="Akash" 'storing String
arrMain(2) = arr 'Stroing an array
Set arrMain(3) = oFso 'storing an obj 
arrMain(4) = True 'storing an Boolean

For i=0 to Ubound(arrMain)
	If IsObject(arrMain(i))Then
		msgbox arrMain(i).BuildPath("C:\abc","xyz") ' Returns :  "C:\abc\xyz"

	Elseif IsArray(arrMain(i)) Then
		temp = arrMain(i)
		msgbox temp(1)   ' Returns :  4
		msgbox arrMain(i)   ' Returns 1, Akash and 4 in the loops
	End If

Download Above Code


Add your comments...
Name : *      
Email : *      
The content of this field will be kept private and will not be shown publicly

Your Comment/Answer *

Enter the text present in this box : *