• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Easy stupid VB object incrementing question...

brxndxn

Diamond Member
I want to run a script that is going through all the objects on a display and setting the 'caption' properties to variables.. I can easily do that by just hard-coding the text display objects..

For example.. here is my current code:

text1.Caption = "a"
text2.Caption = "a"
text3.Caption = "a"

I want to do something like this..

For varCounter 1 to 3
text+varCounter.Caption = "a"
Next

What is the syntax to use a variable in the object reference?
 
This is nuts.. I thought it would be simple to do a 'for/next' loop for something like this..

text1.caption = "a"
text2.caption = "a"
text3.caption = "a"
...
textn.caption = "a"



like..

For 1 to n
x = 1
textx.caption = "a"
x = x + 1
next

I just dunno how to get the x in my statement..
 
Originally posted by: brxndxn
This is nuts.. I thought it would be simple to do a 'for/next' loop for something like this..

text1.caption = "a"
text2.caption = "a"
text3.caption = "a"
...
textn.caption = "a"



like..

For 1 to n
x = 1
textx.caption = "a"
x = x + 1
next

I just dunno how to get the x in my statement..

Nothing's that easy with vb. 😉
 
brxndnx, what you are trying to do i(with that logic) is not possible. You'd have to do something similar to what klin suggested above, which i'm not sure is possible in vb6.
 
Back
Top