locked
Error - Head First C# - Chapter 1 RRS feed

  • Question

  • Hello, I am a total begginer to c#.

    After searching a lot, I decided to read the Head first book.

    My code, for page 47, is not going good. Can someone tell me the error?

    Ps: Sorry for the bad English /:

    namespace WindowsFormsApplication2
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void pictureBox1_Click(object sender, EventArgs e)
            {
                MessageBox.Show(“Contact List 1.0.\nWritten by: me”, “About”);
            }
        }
    }

    Thank you.

    Saturday, June 8, 2013 3:29 PM

Answers

  • Do not copy the source code from the book, type it manually. Because the books usually use a variety of fonts and typographic symbols, which are not recognized by the compiler. In this case the problem is in quotation marks.

    From your book:

    MessageBox.Show(Contact List 1.0.\nWritten by: me, About);

    Right:

    MessageBox.Show("Contact List 1.0.\nWritten by: me", "About");


    Saturday, June 8, 2013 7:22 PM

All replies

  • What's your problem? Do you get any error message? Then it may be helpful, if you could show us the message you received.
    Saturday, June 8, 2013 4:54 PM
  • Do not copy the source code from the book, type it manually. Because the books usually use a variety of fonts and typographic symbols, which are not recognized by the compiler. In this case the problem is in quotation marks.

    From your book:

    MessageBox.Show(Contact List 1.0.\nWritten by: me, About);

    Right:

    MessageBox.Show("Contact List 1.0.\nWritten by: me", "About");


    Saturday, June 8, 2013 7:22 PM