Codechef4u is a community for computer professionals,by computer professionals,just like you; who loves sharing and helping each others,Join them
Share your post

How to create a message box with "Yes", "No" for windows application?

Implementing DialogResult confirmation yes/no:

I have some tree structured data in windows application I want confirmation before any action on child nodes.

i.e Delete Node, Update title for node , Copy node etc. how I can implement that?


You can Display a confirmation dialog, using simple yes/no dialog, check following code for same

        //Code that confirms weather you want to delete node
            DialogResult dialogResult = MessageBox.Show("Do you want to delete this node?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (dialogResult == DialogResult.No)
                return false;
                //proceed deleting node