100 Labels

D

David de Passos

Hi!
I have 100 xrLabels and I need to put in text property a value but I don't
want to write 100 lines of code, like something like that:

for i=1 to 100
xrLabel(i).Text= i
next

How can do that?

--


Cumprimentos,
David de Passos
--------------------------------------------------------------
RCSOFT, Lda.
E-Mail: (e-mail address removed)
Móvel: +351 966931639
Telefone: +351 239708708
Fax: +351 239708701
Tel. Directo: +351 239708705 ext. 401
 
K

Ken Tucker [MVP]

Hi,

dim i as integer = 1
For each ctrl as control in me.controls
if typeof ctrl is label then
ctrl.text=i.tostring
i+=1
end if
next

Ken
---------------------

Hi!
I have 100 xrLabels and I need to put in text property a value but I don't
want to write 100 lines of code, like something like that:

for i=1 to 100
xrLabel(i).Text= i
next

How can do that?

--


Cumprimentos,
David de Passos
--------------------------------------------------------------
RCSOFT, Lda.
E-Mail: (e-mail address removed)
Móvel: +351 966931639
Telefone: +351 239708708
Fax: +351 239708701
Tel. Directo: +351 239708705 ext. 401
 
P

Phill. W

David de Passos said:
I have 100 xrLabels and I need to put in text property a value
but I don't want to write 100 lines of code

Youcould create an array of 100 Labels, add each Label control
into it, then iterate through that, something like

Dim AllLabels as Label() = { Me.Label1, Me.Label2, ... }

(OK, OK; it's a *bit* trickier with 100 of them!)

then

For Each eLabel as Label in AllLabels
eLabel.Text = ""
Next

HTH,
Phill W.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Regional Settings 1
PrevInstance 3
100 Labels 4
IP 1
Running Program 8
TextBox 2
DataGrid 2 1
Query Timeout 3

Top