Reputation: 75
I'm trying to convert an int
which I get from a database, which is an RBG code (without the formatting e.g 111000111 instead of 111,000,111) and trying to convert it to a hexadecimal number.
Has anyone got an idea how I would do this?
Upvotes: 0
Views: 172
Reputation: 1039498
You could use the FromArgb method:
int number = 111000111;
Color c = Color.FromArgb(number);
string hex = string.Format("{0:x}{1:x}{2:x}", c.R, c.G, c.B);
Upvotes: 2