MessageBox.Show error dialogresult

0

I do not know what I did but the error:

  

Error 4 A using namespace directive can only be applied to namespaces;   'System.Windows.Forms.MessageBoxIcon' is a type not a   namespace C: \ Users \ Guilherme \ Documents \ PanelX \ PanelX \ Form1.cs 25 7 PanelX

error print: link

public void button9_Click(object sender, EventArgs e)
{
    if (MessageBox.Show("mensagem", "titulo",  MessageBoxIcon.Warning, MessageBoxButtons.YesNo) == DialogResult.Yes)
    {

    }
}
    
asked by anonymous 07.09.2015 / 06:18

1 answer

2

The error says to look at line 25. You will surely find this:

using System.Windows.Forms.MessageBoxIcon;

This does not work because MessageBoxIcon is not a namespace, it's a enum . So just import the namespace that contains MessageBoxIcon .

using System.Windows.Forms
    
07.09.2015 / 10:05