How to make string become color type?

In the set range color activity, it needs to put color type in the color input box.
If I want to set the different colors in a cell by for each loop, how to make the color change?
I mean how to put a variable in system.drawing.color.(variable)?

image

I am thinking to input “system.drawing.color.”+ variable
but it’s string type not color type…it’s not accept.

Hi @lin.cw.lin
you can try to translate the color name from string to color , i.e from “red” to color[red],
this can be done using color translator method , which converts the string value of color into color of type system.drawing.color

ColorTranslator.FromHtml(“red”)

Thanks
Aj

Hi @lin.cw.lin

Try the below code

System.Drawing.Color.FromName("Green")
1 Like

@aanandsanraj
It works. Thanks a lot!!

You are welcome @lin.cw.lin

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.