Creating a confirmation box c#

Creating a confirmation box c#

I am having a bit of a problem. I am still new to C# however I am progressing slowly and learning new things.

I am having a bit of a problem. I am still new to C# however I am progressing slowly and learning new things.

However I am confused. I am trying to create a confirmation box. However it doesn't seem to function the way it is intended to.

Here is the code:

private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
    MessageBox.Show("Are you sure you want to exit off the application", "Are you sure?", MessageBoxButtons.YesNoCancel); //Gets users input by showing the message box

if (DialogResult == DialogResult.Yes) //Creates the yes function
{
    this.Close(); //Exits off the application
}

else if (DialogResult == DialogResult.No)
{
    //Does nothing
}


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

C/C++ vs. Rust: A developer’s perspective

In this post, you'll see the difference between Rust and C/C++ in a developer’s perspective

Variable Introduction in C#[Bangla]

LIKE | COMMENT | SHARE | SUBSCRIBE A variable is nothing but a name given to a storage area that our programs can manipulate. Each variable in C# has a speci...