Messagebox.Show error dialogresult

Asked

Viewed 107 times

0

I don’t know what I did but the mistake:

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 Painelx Painelx Form1.Cs 25 7 Painelx

error print : http://prntscr.com/8dhnl8

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

    }
}

1 answer

2

The bug says to look on line 25. You will definitely find this:

using System.Windows.Forms.MessageBoxIcon;

That doesn’t work because MessageBoxIcon is not a namespace, is a enum. Then just import the namespace it contains MessageBoxIcon.

using System.Windows.Forms

Browser other questions tagged

You are not signed in. Login or sign up in order to post.