You are correct Chris, sorry was in the middle of two different projects when posted this tip but still no excuse., the string.Format() method would easily suffice for formatting the rgb to hex. EdMan apoligies for the lack of explanation on the tip/trick, thought the title gave it away, sometimes we forget to remember that the tip/tricks that we supply are also read by newbies to the language and should be adaquately explained. String.Format is a very important tool you will want to read up on this topic. A simple example would be MessageBox.Show(String.Format("Your Name is {0}!!!", textBox1.Text)); if the text in textBox1 is EdMan the output would be.... Your Name Is EdMan!!!
Wouldn't have an answer to what Chris Trelawny-Ross said but it would have been nice for you to explain what the code actually does, given that I, along with many others I'm sure, have little or nor idea about and string formatting
Umm... the string.Format() method (with the format string you're using) will quite nicely give you the hex value of the RGB values you pass in, without having to involve the ColorTranslator.
Am I missing something?
Last Visit: 31-Dec-99 18:00 Last Update: 6-Jun-23 22:17