Code snippet for messagebox with YesNoCancel buttons in C#

Code snippet for messagebox with YesNoCancel buttons in C#:

System.Windows.Forms.DialogResult dr = MessageBox.Show("Record has been changed.Do you want to save it?", "", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);

        if (dr == DialogResult.Yes)

        {

            // Code

        }

        else if (dr == DialogResult.No)

        {

            // Code

        }

        else

        {

            // Code

        }