"FindComponent" equivalent in VB?

PaulGer

Registered User.
Local time
Today, 01:37
Joined
Oct 6, 2003
Messages
10
Hi, I am trying to change the properties of a bunch of labels on my form, using a For loop, like such;
Code:
    For i = 1 To 4
        Me.lblRuleCLass(i).ForeColor = "8421504"
    Next i
However, this doesn't work :( so basically I was looking for the VB equivalent of the "FindComponent" function of Delphi which lets you do the same thing.

Thanks.
 
Something like
Function MoveTextBox()
Dim frm As Form
Dim ctl As Control
Set frm = Screen.ActiveForm
For Each ctl In frm.Controls
Select Case ctl.ControlType
Case acTextBox, acComboBox, acLabel
If ctl.Tag = "A" Then
Else

ctl.top = ctl.top - 300
End If

End Select


Next
End Function
 
Thanks Rich, that set me off in the right direction. I slightly modified it to this;
Code:
    Dim ctl As Control
    For Each ctl In Screen.ActiveForm.Controls
        If ctl.ControlType = acLabel And ctl.Tag = "ch" Then
            ctl.ForeColor = "8421504"
        End If
    Next
And it's working, cheers :)
 

Users who are viewing this thread

Back
Top Bottom