Results 1 to 11 of 11

Thread: [RESOLVED] Changing the Background Colour

Hybrid View

  1. #1
    Frenzied Member wiz126's Avatar
    Join Date
    Jul 2005
    Location
    Mars,Milky Way... Chit Chat Posts: 5,733
    Posts
    1,080

    Re: Changing the Background Colour

    The best way to do it is to use the "Microsoft Common Dialog Control"

    Edit: I see MartinLiss Beat ME :\
    1) If your post has been adequately answered please click in your post on "Mark Thread Resolved".
    2) If someone has been useful to you please show your respect by rating their posts.
    3) Please use [highlight="VB"] 'your code goes in here [/highlight] tags when posting code.
    4) Before posting your question, make sure you checked this links:
    MICROSOFT MSDN -- VB FORUMS SEARCH

    5)Support Classic VB - A PETITION TO MICROSOFT

    ___________________________________________________________________________________
    THINGS TO KNOW ABOUT VB: || VB Examples/Demos
    What are Classes?
    || -
    Where to place a sub/function?(global) || Webbrowser control

  2. #2

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Location
    Glastonbruy
    Posts
    14

    Re: Changing the Background Colour

    Thank you very much works perfectly

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: Changing the Background Colour

    Quote Originally Posted by Argh two glass eyes
    Thank you very much works perfectly
    Just in case someone presses Cancel.

    VB Code:
    1. Private Sub Command1_Click()
    2.  
    3. Dim frm As Form
    4.  
    5. On Error GoTo ErrorRoutine
    6.  
    7. CommonDialog1.CancelError = True
    8. CommonDialog1.ShowColor
    9. For Each frm In Forms
    10.     frm.BackColor = CommonDialog1.Color
    11. Next
    12.  
    13. Exit Sub
    14.  
    15. ErrorRoutine:
    16.  
    17.     If Err.Number = 32755 Then
    18.         MsgBox "You pressed Cancel rather than selecting a color"
    19.     End If
    20.  
    21. End Sub

  4. #4

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Location
    Glastonbruy
    Posts
    14

    Re: Changing the Background Colour

    Quote Originally Posted by MartinLiss
    Just in case someone presses Cancel.

    VB Code:
    1. Private Sub Command1_Click()
    2.  
    3. Dim frm As Form
    4.  
    5. CommonDialog1.ShowColor
    6. For Each frm In Forms
    7.     frm.BackColor = CommonDialog1.Color
    8. Next
    9.  
    10.  
    11. End Sub
    Thanks but i'm now having the problem of it only changing the background colour of two forms. the one that i select the colour in and a main menu form

  5. #5
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431

    Re: [RESOLVED] Changing the Background Colour

    It will only change the color of the currently loaded forms. If you want to change the color of forms loaded later, put the following in their Load subs.

    Me.BackColor = Form1.CommonDialog1.Color

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width