Winforms csv file generation, want to generate file then ask user to save it or open it

StackOverflow https://stackoverflow.com/questions/230359

  •  04-07-2019
  •  | 
  •  

Question

When a user clicks on a button on the winforms application, I will generate a CSV file.

I then want to ask the user to either save the file to disk OR open the file.

How can I do that?

Note: I am just generating the file in memory, not writing it to disk until the user selects the path to save it to.

No correct solution

OTHER TIPS

If you are looking to open this for the user in the default application for CSV on their machine, you will need to write it to disk to make it happen.

What I would do is if they want to save it, just save it to their location!

If they want to open it, save it to the temp directory, then use System.Diagnostics.Process.Start(path) to open it in the default application.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top