+ 1

I need help: C#

hello... i am a begginer..so i need help... for example, for int it work.. int colors; colors = int.Parse (textBox1.Text); switch (colors) { case 1: MessageBox.Show("you choosed red"); break; case 2: MessageBox.Show("you choosed yellow"); break; case 3: MessageBox.Show("you choosed blue"); break; case 4: MessageBox.Show("you choosed black"); break; default: MessageBox.Show("colors not found"); break; } but I want to do with string.. but not work String colors; colors = textBox1.Text; switch (colors) { case red: MessageBox.Show("you choosed red"); break; case yellow: MessageBox.Show("you choosed yellow"); break; case blue: MessageBox.Show("you choosed blue"); break; case black: MessageBox.Show("you choosed black"); break; default: MessageBox.Show("colors not found"); break; } so.. it seems the problem would be with string and textbox1

4th Jan 2018, 4:34 PM
BogdanN997 @ Pablo
BogdanN997 @ Pablo - avatar
2 Answers
+ 1
aaaaaaaa, ooook, thank you very much
4th Jan 2018, 5:06 PM
BogdanN997 @ Pablo
BogdanN997 @ Pablo - avatar