TextBox, Index & Arraylist

Peptone

New Member
Good Afternoon to everybodies! :cool:

I've a little problem, obviously.

I've 81 TextBox and I need to write everyone at same time using a For cicle.
In VB6 I can draw every TextBox with same name and use an index (Index).
I don't find that in Basic4ppc... I suppose using ArrayList but I don't know this object :sign0013:

Example
If I was 3 TextBox1:
TextBox1(0)
TextBox1(1)
TextBox1(2)

It should have to sound so (this code is a mix between B4ppc and Index like VB6):

Sub Button1_Click
For i =0 to 2
TextBox1(i).Color = cRed
Next i
End Sub

Sub Button2_Click
For i =0 to 2
TextBox1(i).Color = cGreen
Next i
End Sub


Thax!
 

BjornF

Active Member
Licensed User
Dear Peptone,

you can use the Control keyword (see the helpfile)

In your example you could have three different textboxes
TextBox1
TextBox2
TextBox3

and then change the color as below

Sub Button1_Click
For i =1 to 3
Control("TextBox"&i).Color = cRed
Next i
End Sub

and so on.

all the best / Björn


Editing:
Arrgh, too late... Erel, you got there first as usual
 
Top