Color Dialog

G

Guest

Hi,

when using this code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click

Dim MyDialog As New ColorDialog()
MyDialog.AllowFullOpen = False
MyDialog.ShowHelp = True
MyDialog.Color = TextBox1.ForeColor

If (MyDialog.ShowDialog() = Windows.Forms.DialogResult.OK) Then
TextBox1.ForeColor = MyDialog.Color
End If

End Sub

the variable TextBox1.ForeColor gets the value of "{Name=ffff8040,
ARGB=(255, 255, 128, 64)}".
How do I extract only the last three numbers in a string in a format like
"255 128 064"?

Thanks for help
Thomas
 
G

Guest

Maybe I am to stupid bt I do not understand your solution. I am wrinting in
VB 2005 Express. Could you possibly write your solution with using my
variables?

Thanks a lot
 
H

Herfried K. Wagner [MVP]

tmoeller said:
Maybe I am to stupid bt I do not understand your solution. I am wrinting
in
VB 2005 Express. Could you possibly write your solution with using my
variables?

\\\
Dim c As Color = ...
Dim s As String = String.Format("{0} {1} {2}", c.R, c.B, c.G)
///
 
G

Guest

Great. Thanks a lot so far.
In this case I have to assign a color to the variable c but I want the
result by dynamic by picking a color inside the dialog. When doing this the
color is assigned to the variable MyDialog.Color. And it is not possible (for
me) to put the value of MyDialog.Color in a string.

Please respond.
 

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

Similar Threads


Top