Add counter

I have this small code to build some labels.
I want to add a counter start from 100 and rising per 50 every time in loop,is possible and how ?

[code] Dim pr as text = “label”
Dim tlabel as iOSLabel = new iOSLabel
dim fix as text = “,200,20”
dim counter as integer

for x as integer = 50 to 60
tlabel.Name = “(”+ pr + x.ToText +",0," + counter.ToText + fix +")"
tlabel.Text = pr+x.ToText
dtview2.AddControl(tlabel)
if x > 49 then
tlabel.TextColor = Color.Green
end if
next[/code]

Dim pr as text = "label"
  Dim tlabel as iOSLabel = new iOSLabel
  dim fix as text = ",200,20"
  dim counter as integer =100 //<<--- INITIALIZE YOUR COUNTER HERE
  
  for x as integer = 50 to 60
counter=counter+50 //<--------------------------------- INCREMENT YOUR COUNTER
    tlabel.Name = "("+ pr + x.ToText +",0," + counter.ToText + fix +")"
    tlabel.Text = pr+x.ToText
    dtview2.AddControl(tlabel)
    if x > 49 then  // <<----------------------------- THIS IS USELESS, AS X WILL NEVER BE <49 [your loop started at 50]
      tlabel.TextColor = Color.Green
    end if
  next

and you cannot NAME a label “(label50,0,50,200,200)”

are you sure you are not trying to create, name, and position a label
and if that is the case, don’t you need to define CONTRAINSTS instead of absolute positons

Thank you Dave.
They are is some labels with fixed position for scrollview dtplugin for iOS from jean-paul,and i am try to do by code.
the actual format to add the control on the scrollview is this dtview2.AddControl(label50,75,25,150,20)
75= left
25=height position on the scrollview
150 = width
20 =height of label

based on you last post…

dtview2.AddControl(label50,75,25,150,20)… or generically dtview2.AddControl(title, left, top, width, height)

NOT as you code is doing it
which is dtview2.AddControl(string)

Don’t you need/want to

dtview2.AddContrl(pr+x.toText , 0 , counter , 200 , 20 )

Thank you again Dave…
This dtview2.AddContrl(pr+x.toText , 0 , counter , 200 , 20 ) is the answer you are right…
Still i have many things to learn in xojo.From livecode to xojo there is no easy path. :slight_smile: