Solved

Global Form Changes

Posted on 2002-07-24
5
254 Views
Last Modified: 2010-05-02
I want to change the background color of all the forms, labels, textboxes, etc.... at runtime in a module or something.  Is there an easy way to do this.  This issue is I don't want to have to manually edit each form.

Any input would be appreciated.

Thanks in advance.
0
Comment
Question by:Baddogi
5 Comments
 
LVL 18

Accepted Solution

by:
bobbit31 earned 100 total points
ID: 7174748
if your command buttons are all graphical:

Public Sub changeColor(frm As Form, clr As Long)
frm.BackColor = clr
For Each cntrl In frm.Controls
    cntrl.BackColor = clr
Next
End Sub
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7174750
you'll still probably have to do some tweaking (especially if using frames)
0
 
LVL 20

Expert Comment

by:hes
ID: 7174778
For Loaded Forms:

Dim MyForms As Form
For Each MyForms In Forms
  MyForms.BackColor = vbBlue
Next
0
 
LVL 22

Expert Comment

by:rspahitz
ID: 7174828
One way is to change the contents of the .frm!  Locate the desired control by reading through the .frm, then change the color setting.

Also, if you want your form to always match a windows setting, you can have it reference the system colors rather than the palette...or vice-versa.
0
 

Author Comment

by:Baddogi
ID: 7175185
Thanks - that'll do the trick........  :)
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

685 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question