Tutorial by Examples

Dim cars(2) cars(0) = "Ford" cars(1) = "Audi" cars(2) = "Prius"
Dim cars() Redim cars(0) 'Give it 1 entry Dim tmp tmp = "Ford" 'ubound(arrayvariable) is the count of array size. 'in this case, it would be 1, since there is 1 entry. cars(ubound(cars)) = tmp 'cars(0) Redim preserve cars(ubound(cars)+1)
Dim cars Dim filefullname : filefullname = "C:\testenv\test.txt" 'If you can, create an instaneous read for text file data for better memory handling. 'Unless it's a large file and that's impossible. cars = Split(CreateObject("Scripting.FileSystemObject").OpenTextFile(filefu...
You cannot alter the array's contents through the loop variable because it's a temporary each element is being assigned to. Dim cars(2) 'collection of different cars Dim trace 'track iteration details cars(0) = "Ford" cars(1) = "Audi" cars(2) = "Prius" For Each ca...
Dim i, cars(2) cars(0) = "Ford" cars(1) = "Audi" cars(2) = "Prius" For i=0 to ubound(cars) If cars(i) = "Audi" Then Exit For Next
Dim x, cars x = 0 cars = Split(CreateObject("Scripting.FileSystemObject").OpenTextFile("C:\testenv\example.txt", 1).ReadAll, vbcrlf) Do While x < ubound(cars) If cars(x) = "Audi" Then Exit Loop x = x + 1 Loop
Dim copycars(), cars(2), x Redim copycars(0) x = 0 cars(0) = "Ford" cars(1) = "Audi" cars(2) = "Prius" Do Until x = ubound(cars) copycars(ubound(copycars)) = cars(x) redim preserve copycars(ubound(copycars)+1) x = x + 1 Loop redim preserve copycar...
Dim mdArray(2,3) mdArray(0, 0) = "test1" mdArray(0, 1) = "test2" mdArray(0, 2) = "test3" mdArray(0, 3) = "test4" mdArray(1, 0) = "test5" mdArray(1, 1) = "test6" mdArray(1, 2) = "test7" mdArray(1, 3) = "test8" md...
Dim mddArray() ReDim mddArray(0) Dim ti, testinc: testinc = "test": ti = 1 For i = 0 To 4 Dim tmpArray(): ReDim tmpArray(0) For j = 0 To 3 tmpArray(UBound(tmpArray)) = testinc & ti ti = ti + 1 ReDim Preserve tmpArray(UBound(tmpArray) + 1) Ne...

Page 1 of 1