Home All Groups Group Topic Archive Search About
Author
2 Feb 2006 10:15 PM
Wonder
I'm pulling a value from the db that is an integer, ie 6421504.  I then want
to use
these value to change the color of the text.  How can I
convert this integer value to a color in vb.net?

Thanks,

Author
2 Feb 2006 10:55 PM
Armin Zingler
"Wonder" <Won***@discussions.microsoft.com> schrieb
> I'm pulling a value from the db that is an integer, ie 6421504.  I
> then want to use
> these value to change the color of the text.  How can I
> convert this integer value to a color in vb.net?


    dim i as integer = 6421504
    dim c as color

    c = System.Drawing.Color.FromArgb(i)


Probably the Alpha channel is missing, so you'd have to use

    c = System.Drawing.Color.FromArgb(i or &Hff000000)




Armin
Author
2 Feb 2006 11:02 PM
Herfried K. Wagner [MVP]
"Wonder" <Won***@discussions.microsoft.com> schrieb:
> I'm pulling a value from the db that is an integer, ie 6421504.  I then
> want
> to use
> these value to change the color of the text.  How can I
> convert this integer value to a color in vb.net?

Check out 'Color.From*' and the 'ColorTranslator' class.

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>