Forums - C# Corner

Forum guidelines
Richard Arnold

Richard Arnold

  • 746
  • 7
  • 14k

Responding to DialogResult RetryCancel

Jan 1 2013 8:52 PM
My application allows the user to select a particular file to import from a ToolStripDropDownButton. The code then displays an OpenFileDialog for them to browse to the file to import.
As the file actually chosen may be different from the selected ToolStripDropDownButton item, I want to  prevent an incorrect file from being copied. I wrote a method which compares the two selections and displays a RetryCancel DialogResult in a MessageBox.

If the user clicks "Retry", I want to return to the calling code's OpenFileDialog for the user to make another file selection.

If the user clicks "Cancel", I do Not want to exit the application, just allow the user to continue using the application.

How do I return to the calling code's OpenFileDialog based on the "Retry" button and how can I handle the "Cancel" button?

I have attached the simple method example. Thank you in advance.

Answers (2)

C# Corner Hyderabad Developer Conference

SPONSORED BY

Spire.Doc - Free .NET Word API
Use Spire.Doc to create, read, write, print, and convert word documents to OpenXML, RTF, TXT, XPS, EPUB, EMF, HTML, Image and PDF.