private void button1_Click(object sender, EventArgs e)
{
string answer = (@"class SecLevel \n { \n static void Main()\n{Console.WriteLine("Hello World!");}}");
if (textBox1.Text == answer)
{
MessageBox.Show( "Good!");
}
}
Asked
Active
Viewed 97 times
-8

John Saunders
- 160,644
- 26
- 247
- 397

Tom and Jerry
- 1
- 1
-
1string doesn't take values – Tom and Jerry Mar 13 '15 at 14:33
-
5You might wanna include a question? Like how to I solve "XYZ" problem. – Nisd Mar 13 '15 at 14:33
-
string answer = (@"class SecLevel \n { \n static void Main()\n{Console.WriteLine("Hello World!");}}") this line is error – Tom and Jerry Mar 13 '15 at 14:35
1 Answers
0
It is because of the "Hello World!" you need to escape the ",
do this instead:
"class SecLevel \\n { \\n static void Main()\\n{Console.WriteLine(\"Hello World!\");}}"

TheLethalCoder
- 6,668
- 6
- 34
- 69