Amend command button colours via public constants and load event of each form (1 Viewer)

chrisjames25

Registered User.
Local time
Today, 23:19
Joined
Dec 1, 2014
Messages
377
Doh i was doing so well. Not sure if this should be new thread or not as very related but i have now added the following code to do forecolor as well but it seems to make the box turn black not orange. If this not how you would type to change the forecolor:

Code:
Dim ctl As Control
For Each ctl In Me.Controls
      If ctl.Tag = "C" Then ctl.BackColor = ConButtonBackColor And ctl.ForeColor = ConButtonBackColor
Next

Appreciate i am turning forecolor and backcolor the same color in this example - not my final plan but was just testing code and sure the issue straightaway.
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:19
Joined
Oct 29, 2018
Messages
18,764
Doh i was doing so well. Not sure if this should be new thread or not as very related but i have now added the following code to do forecolor as well but it seems to make the box turn black not orange. If this not how you would type to change the forecolor:

Code:
Dim ctl As Control
For Each ctl In Me.Controls
      If ctl.Tag = "C" Then ctl.BackColor = ConButtonBackColor And ctl.ForeColor = ConButtonBackColor
Next

Appreciate i am turning forecolor and backcolor the same color in this example - not my final plan but was just testing code and sure the issue straightaway.
You need to split them in two lines. For example:
Code:
If ctl.Tag="C" Then
    ctl.ForeColor=ConButtonBackColor
    ctl.BackColor=ConButtonBackColor
End If
 

chrisjames25

Registered User.
Local time
Today, 23:19
Joined
Dec 1, 2014
Messages
377
You need to split them in two lines. For example:
Code:
If ctl.Tag="C" Then
    ctl.ForeColor=ConButtonBackColor
    ctl.BackColor=ConButtonBackColor
End If
Perfect. Exactly what needed. Thank you all so much. Until next time i get stuck (knowing me a few hours)
 

theDBguy

I’m here to help
Staff member
Local time
Today, 15:19
Joined
Oct 29, 2018
Messages
18,764
Perfect. Exactly what needed. Thank you all so much. Until next time i get stuck (knowing me a few hours)
You're very welcome. We were all happy to assist. Good luck with your project.
 

Users who are viewing this thread

Top Bottom