Hello All,
I've been head scratching, googling and experimenting to try to find the right way of doing this but to no avail.
Here's what I want to do:
Apply a common 'theme' to each of the controls on each of my forms by looping through all the controls on each form when it loads (or should it be initialise?) and applying common colours\styles etc, according to the type of control. To save code I was hoping to have this theme code in a module so it could be called from any one of the forms
So here's what I thought would work:
In each of the Form Load subs:
and in a module:Code:Dim ACtl As Control For Each ACtl In Me.Controls SetTheme(ACtl) Next
but it doesnt work......Code:Public Sub SetTheme(ACtl As Control) If (TypeOf ACtl Is DTPicker) Then ACtrl.BackColor = RGB(255, 255, 255) 'white ACtrl.ForeColor = RGB(255, 128, 0) 'orange ElseIf TypeOf ACtl Is TextBox Then ACtl.ForeColor = vbRed 'etc 'etc End If End Sub
Any ideas ?
Thanks, I've got a lot learn on this subject...........




Reply With Quote
