How to make a 'quick and dirty' array

This tip illustrates how can you quickly create an array by using the evaluate command.

This tip illustrates how can you quickly create an array by using the evaluate command.
Dim evalString As String
Dim myVar As Variant
Dim i As Integer

evalString = {"A":"B":"C":"D"}
myVar = Evaluate(evalString)

'Creates an array of strings where
'myVar(0) = "A"
'myVar(1) = "B"
'myVar(2) = "C"
'myVar(3) = "D"

Msgbox {The string "} & evalString & {" when Evaluate'd gives the 
following values} For i = Lbound(myVar) To Ubound(myVar) Msgbox "myVar(" & Cstr(i) & ") = """ & myVar(i) & """" Next 'Similarly evalString = {1:2:3:4} myVar = Evaluate(evalString) 'Creates an array of numbers where 'myVar(0) = 1 'myVar(1) = 2 'myVar(2) = 3 'myVar(3) = 4 Msgbox {The string "} & evalString & {" when Evaluate'd gives the
following values} For i = Lbound(myVar) To Ubound(myVar) Msgbox "myVar(" & Cstr(i) & ") = " & myVar(i) Next
Please visit our website http://www.novadata.com/ID=RMES-586NYN for more tips.
This was first published in March 2002

Dig deeper on Domino Resources - Part 6

0 comments

Oldest 

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

SearchWinIT

Search400

  • iSeries tutorials

    Search400.com's tutorials provide in-depth information on the iSeries. Our iSeries tutorials address areas you need to know about...

  • V6R1 upgrade planning checklist

    When upgrading to V6R1, make sure your software will be supported, your programs will function and the correct PTFs have been ...

  • Connecting multiple iSeries systems through DDM

    Working with databases over multiple iSeries systems can be simple when remotely connecting logical partitions with distributed ...

SearchEnterpriseLinux

SearchVirtualDataCentre.co.uk

Close