Results 1 to 3 of 3

Thread: [RESOLVED] Control background color conversion help.

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2013
    Posts
    3

    Resolved [RESOLVED] Control background color conversion help.

    Hi all!

    I am a recent (This week is my first) convert from VB6 to VB2010. The learning curve has been a little painful, but I seem to have database access and other items in hand. What I am struggling with is background colors on controls at runtime. I am reading a 3rd party database where I cannot alter how the data is stored. A field in the data has the background color stored as what appears to be a Int32. Any suggestions on how to convert this to a value that is acceptable to VB2010 ? I included the hex values below as reference, but how to apply the int value to the BG color is the real issue.

    Thanks in advance.

    Example#1
    Color: Aqua/Cyan (0FFFF)
    Database value: 16776960

    Example#2
    Color: Lt Pink (FF99CC)
    Database value: 13408767

    Example #3
    Color:Med Blue (0082FF)
    Database Value: 16744960

  2. #2
    PowerPoster stanav's Avatar
    Join Date
    Jul 2006
    Location
    Providence, RI - USA
    Posts
    9,290

    Re: Control background color conversion help.

    Use Color.FromArgb function
    Code:
    myControl.BackColor = Color.FromArgb(16776960)
    Let us have faith that right makes might, and in that faith, let us, to the end, dare to do our duty as we understand it.
    - Abraham Lincoln -

  3. #3

    Thread Starter
    New Member
    Join Date
    Feb 2013
    Posts
    3

    Re: Control background color conversion help.

    Thanks, perfect.

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