The Screen shot shows the Code and the error.
Monterey 12.6
Xojo 2021r2.1
m1 MacBook Pro
Color.Black is defined in the Language Reference.
The Screen shot shows the Code and the error.
Monterey 12.6
Xojo 2021r2.1
m1 MacBook Pro
Color.Black is defined in the Language Reference.
TF_Color_Black.Text = Str(Color.Black)
' or
TF_Color_Black.Text = Color.Black.ToString
Thanks Martin, I will test.
The strange part is… this syntax works for all other Constants I used… (RGB, CMY, …)
I think. But my brain need a rest right now andI do not talk about my stomach
No it does not.
Here’s the code:
// Far above:
BgColor = Color.FromString("&H" + TF_Color_Hex_Value.Text)
// Many lines, then:
TF_Color_Black.Text = BgColor.Black.ToString
BgColor is no the class, but maybe a variable and that can confuse the compiler.
BgColor is a Color Property.
Yes, but for Class Constants you should use the class name, not the name of an instance of the class. Instead of
// rather than:
BgColor.Black.ToString
// use:
Color.Black.ToString
There are some rare instances where you can get away with it, but not many and it should be avoided.
I do not want to Paint it Black, but to get the Black part of a Color.
Did you read Greg answer above ?
Sorry, I can’t see anything from Greg in this thread?
Emile got confused with this other thread: How do I get K with CMY Function?
What Emile is trying to do with BgColor.Black is to get the K (black part) of the color assigned to BgColor. On the other thread, Greg explains this.
Ah, that’s not what black is in this context. Color.black returns the colour black.