Results 1 to 10 of 10

Thread: [RESOLVED] Changing background color

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 2008
    Posts
    53

    Resolved [RESOLVED] Changing background color

    hi all, this is my first post, im quite a noob let it be said!

    i have a frame, in the frame i have a dropdown box with 3 options...

    Open, Pending and Closed, and as you can see im trying to make the fram background color change for whichever option on the dropdown is selected.

    Its giving me a huge headache at this stage and im sure one of you wise ones can point me in the right direction, thanks!!

    Private Sub ComStatus_Change()
    If ComStatus.Text = "Open" Then
    FrmStatus.BackColor = blue
    ElseIf ComStatus.Text = "Pending" Then
    FrmStatus.BackColor = red
    ElseIf ComStatus.Text = "Closed" Then
    FrmStatus.BackColor = green
    End If
    End Sub

  2. #2
    Hyperactive Member danecook21's Avatar
    Join Date
    Feb 2008
    Location
    NC, USA
    Posts
    501

    Re: Changing background color

    It needs to be in the Click() event instead of Change(). And for the colors, add "vb" in front of them, vbBlue, vbRed etc

  3. #3
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Changing background color

    Welcome to the Forums.

    You need to use the RGB, hex color code or the vb constant colors.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  4. #4

    Thread Starter
    Member
    Join Date
    Nov 2008
    Posts
    53

    Re: Changing background color

    wow nice fast replying there lads, that worked a treat, i did some vb in college like 10 years ago, the vbRed brought back some memories hahaha

    thanks alot!

  5. #5
    Addicted Member
    Join Date
    Apr 2008
    Posts
    198

    Re: Changing background color

    you can use "vb' before the name of the color
    example:
    red=vbred
    green=vbgreen
    IT CTO & System Administrator.

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: Changing background color

    As a new member we would like to let you know that when your question has been answered you should go to the Thread Tools menu and select "Mark Thread as Resolved" so others will know your problem has been solved.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7
    Addicted Member
    Join Date
    Apr 2008
    Posts
    198

    Re: Changing background color

    Quote Originally Posted by RobDog888
    As a new member we would like to let you know that when your question has been answered you should go to the Thread Tools menu and select "Mark Thread as Resolved" so others will know your problem has been solved.
    sorry rob:
    what do u mean?
    IT CTO & System Administrator.

  8. #8
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] Changing background color

    I see you resolved it already so what that now shows to others is that your question has been answered. Anyone looking to help wont have to waste time reading through the thread to find out its finished.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  9. #9
    PowerPoster Spoo's Avatar
    Join Date
    Nov 2008
    Location
    Right Coast
    Posts
    2,656

    Re: [RESOLVED] Changing background color

    Yosef

    Looks like RobDog mistook you for hobobobobobobobob.
    The force is weakening with this one

    Spoo

  10. #10
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: [RESOLVED] Changing background color

    Quote Originally Posted by Spoo
    Yosef

    Looks like RobDog mistook you for hobobobobobobobob.
    The force is weakening with this one

    Spoo
    Nope, yosef_mreh asked me a question so I answered it.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

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