简体   繁体   中英

Error CS1002 - Just trying to do a MessageBox.Show command

I've just started to learn C#.
I use Visual Studio.
I chose the "Windows Forms App (.NET Framework).
I try to open up a message box, but it gives me an CS1002 error .

This is my code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp6
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void vbToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBox.Show("test")
        }
    }
}

CS1002 is a quite explanatory error message about an expected semicolon. You do not have one at the end of your line.

private void vbToolStripMenuItem_Click(object sender, EventArgs e)
{
    MessageBox.Show("test"); // < Semicolon at the end of each line
}

Each line in C#, where it's not a continuing / multiline statement requires a semicolon to terminate.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM