Arrays/macro substitutions

Hi Everybody

Can someone please tell me if VB has something similar to what we had in Clipper called macro substitution.

It worked something like this:
Say for instance I've created 20 vars called cVar1 to cVar20

Now we were able to do the macro substitution (this happened at runtime)

For i = 1 to 20
ci = alltrim(str(i))
cVar&ci = something (any assignment that can be done to a var)
next i

So for each iteration of the loop i would be incremented by 1. ci would then be a char var containing '1' then '2' then '3' and so on.

The & in Clipper was the macro substitution character.

At runtime &ci would then be replaced with whatever value was stored in var ci eg:
On first iteration: ci would be '1' so cVar&ci would be replaced with cVar1
On Second iteration: ci would be '2' so cVar&ci would be replaced with cVar2 etc etc etc.

It's then quite simple to do assignment to vars in loops in stead of assigning each var on it's own.

Do anybody know if this is possible in VB or not.

Any help would be appreciated.

Thanks.

Bezzie
[1227 byte] By [Bezzie] at [2007-11-15 17:37:44]
# 1 Re: Arrays/macro substitutions
Nope, there's nothing like macros in VB, but you can use an array to achieve the same thing:

Dim sVar(1 to 20) as string
Dim i as Integer
for i = 1 to 20
sVar(i) = "Somestring value"
next i
DSJ at 2007-11-10 0:44:01 >