help !! This Code is not working..

saleemMSMS

Registered User.
Local time
Today, 12:16
Joined
Aug 12, 2009
Messages
92
i wrote this code in the switchboard got focus event... but its not working...

Code:
Private Sub Form_GotFocus()
Dim lbl As label
For Each lbl In Controls("Label")
 If lbl.Caption = "Exit" Then
    lbl.ForeColor = 202
    lbl.FontName = "Trebutchet MS"
 End If
Next
End Sub

whats wrong ? i just want to scan all the controls in the form and when they are labels, and when the labels' caption is "Exit", i want to show it in a different color..
what am i missing ?
 
The code would be more efficient if you check the caption of the known label before enumeratinig all the controls. Or can any label have the caption of Exit?

David
 
actually i have 5 different switchboards. all the switchboards have the "return to main" and "go to previous" options. what i need is to bold the letters if the caption says one of the above strings..
how can i do this ?
 
actually i have 5 different switchboards. all the switchboards have the "return to main" and "go to previous" options. what i need is to bold the letters if the caption says one of the above strings..
how can i do this ?
 

Users who are viewing this thread

Back
Top Bottom