I want to be able to change the color of my entire form window by typing a color into a textbox. But it doesn’t work when I type:

^ Error message ^
Does anyone know how to convert the string so it will work? I’ve searched a lot but can’t seem to find any other solution than writing a lot of if or switch statements. Thanks!
Since this looks like homework, I won’t quite give the solution.
First, you don’t want textBox1 itself, but rather its contents, so textBox1.Text.
Second, look at this method: https://docs.microsoft.com/en-us/dotnet/api/system.drawing.color.fromname?view=net-5.0#System_Drawing_Color_FromName_System_String_
Thanks. Also if you are curious this isn’t homework, I am a student, learning how to program but there I’m learning web development, C# is just a hobby I have.
First idea that comes to mind for me would be the following (dont have an ide booted right now, so might wanna check the syntax a bit..)
C# devs
null reference exceptions

source