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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I know i'm missing something obvious....

Status
Not open for further replies.

NTSGuru

Programmer
Jul 25, 2000
52
I have these 2 sets of code, and my brain must have gone into retirement because I can't get them to work... any help anyone?

Dim objLabel As Label
For Each objLabel In frmMain
objLabel.Font = strFont
Next

Dim objBtn As MyHandmadeBtnObj
For Each objBtn In frmMain
objLabel.captioncolor = ColorChoice
Next


TIA
Fred
 
Hi my friend,
Yes you are missing 2 things..
1- Font is an object by it self, if you want to assigne a name for it you have to use .Name
2- To assigne color use RGB() function.
So your code will be like that
Code:
    Dim objLabel As Label
    For Each objLabel In frmMain
        objLabel.Font.Name = strFont
    Next

    Dim objBtn As MyHandmadeBtnObj
    For Each objBtn In frmMain
        objLabel.captioncolor = RGB(X,Y,Z)
    ' X,Y,Z are intergers represent the intensity of each color
    Next
Hope this will help
Thanks,
Walid Magd
Engwam@Hotmail.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top