[RESOLVED] Writing a forecolor value to a string
Hey,
I've set the colour of a label using the ColorDialog and I want to read the chosen colour value into a string, using the following code:
Code:
ColorDialog1.ShowDialog()
label1.ForeColor = ColorDialog1.Color
For example, I have chosen, say, blue as the colour.. How would I read this value into a string, or the hex code for this colour?
Thanks in advance,
PlaystationMasterBoy
Re: Writing a forecolor value to a string
Re: Writing a forecolor value to a string
Fabulous. A*
Thanks a lot.
Re: Writing a forecolor value to a string
How would I then set the forecolor of a different control to equal that that I have written to the varialble. For example, I have written:
Code:
ColorDialog1.ShowDialog()
label1.ForeColor = ColorDialog1.Color
and...
Code:
colour1 = ColorDialog1.Color.Name
How would I then set the forecolor of a different element to the same?
I've tired..
Code:
Button9.ForeColor = colour1
Thanks
Re: Writing a forecolor value to a string
vb Code:
Button9.ForeColor = color.fromname(colour1)
Re: Writing a forecolor value to a string
Quote:
Originally Posted by
.paul.
vb Code:
Button9.ForeColor = color.fromname(colour1)
Thanks. That's a lifesaver. :D
Re: [RESOLVED] Writing a forecolor value to a string
it'd probably be easier to declare colour1 as color:
vb Code:
dim colour1 as color
colour1 = ColorDialog1.Color
...
Button9.ForeColor = colour1