How to invoke a "File Download" Dialog Box in a winform application?

How to invoke a "File Download" Dialog Box in a winform application?

Old forum URL: forums.lhotka.net/forums/t/3588.aspx


yimiqi posted on Monday, September 24, 2007

This question probably doesn't belong here but I googled it and didn't find any luck on the topic. I thought I'd try here since there are many computer gurus is this forum.

I have a winform application and implemented an export button, when the user clicks the export button, I'd like to invoke a standard "File Download" Dialog Box like in IE that will allow user to open the .csv file in the browser when Open button is clicked and saves the .csv file when Save button is clicked.  This is all straightforward if it was a web application.  But as for a windows application, there is only an Open File Dialog Box and a Save File Dialog Box. 

My question is:

Is it possible to invoke the "File Download" Dialog Box like in IE in a winform application?

Or do I have to write my own?

Thank you for any inputs.

 

ajj3085 replied on Tuesday, September 25, 2007

You'd probably have to create your own, because that's really a web paradime, and counter-intiutive on a winforms app.  I'd be very suprised to see such a dialog from a winforms app, and I may even think it was trying to launch a virus or something.   No matter what you're doing to have write a file to disk (unless your app will also can an http server or use IIS), so I'd go the typical Save As dialog result. 

yimiqi replied on Tuesday, September 25, 2007

Thanks for the reply.  Now I see why you thought it sounded like virus activity - I called it a “file download” that I wanted to implement.

What I really want to implement is a ’save as’ dialog with an additional ‘open’ button… similar to the I.E. ‘file download’ dialog.

Anyways, I've moved forward on this issue. 

Thank you.

ajj3085 replied on Wednesday, September 26, 2007

Ahh, you orginally said "invoke the dialog," so I thought you were trying to get IE involved somehow.  As I'm sure you figured out, you'll need to roll your own.

Copyright (c) Marimer LLC