Color Dialog Hash Code

tonycrew

Well-known member
Joined
Apr 20, 2009
Messages
55
Programming Experience
Beginner
Hello, What ive done so far is make 1 textbox show the current hash code of the colour, and it works..

But what i want to do is, In another textbox, you type in a hash code and the color dialog loads the color of that hash code.. Not work!

Ive tried..

VB.NET:
ColorDialog1.Color.GetHashCode(Textbox1.Text)

X

VB.NET:
ColorDialog1.Color = Textbox1.Text

X

VB.NET:
ColorDialog1.GetHashCode(Textbox1.Text)

X

Please help..
 
Hashing is a one-way operation, the only way to get the corresponding value back is to store both in a dictionary for lookup. What are you actually trying to do?
 
Im trying to make it so when you type a colour hash code into the textbox, The ColorDialog will change its hash code to that and its colour..
 
Wouldn't it be more meaningful to type something that would actually represent a color in the textbox in regard to established color systems? The purpose of the Hash algorithm is specifically to prevent anyone finding what value produced the hash value. It is mostly used for security, but also for general lookup tables. Better values that represent colors is the ARGB integer, the Win32 color integer, the Html hex color string, the color string name, or the RGB integer triplets. Have a read in library about the Color structure and the ColorTranslator class and you will find how to convert all the suggested values to and fro Color instances.
 
What happens is that you select a clolour from the colour dialog then it needs to put that hash into a text box, that works but when you load a file that has the hash in it i need it to stay in the textbox and also display the colour in a little box.
 
Back
Top