Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

referring to multiple labels 1

Status
Not open for further replies.

idd

Programmer
Apr 19, 2002
165
GB
Hi All,

If I wanted to refer to more than one label say

label1
label2 and
label3

can I do this by declaring it.

i.e. mylabels = label1,label2,label3

or some other way.

so that I could change the color of them in one go or change any other properties for all of them in one go.

Thanks in Advance for any help

Idd
 
I use the tag property to apply changes to multiple controls...

eg.

Dim ctl As Control
Dim intCount As Integer

For Each ctl In Me.Controls
If ctl.ControlType = acLabel And ctl.Tag = "1" Then
ctl.ForeColor = vbYellow
End If
Next ctl

This will change the forecolor of all labels with the tag set to 1 to Yellow.

You can use the same theory to enable, make visible etc any group of controls in one go.

Hope this is of some help.

There are two ways to write error-free programs; only the third one works.
 
Thanx Alot GHolden

I didnt know about the tag property before.

I really Appreciate your help.

Idd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top