Integer to color

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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,
 
Wonder said:
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
 
Wonder said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top