[RESOLVED] [2008] Copy file to local machine and allow it to open
We have an app that tracks .DOC and .PDF files (and possibly other file extensions). It stores copies of them on a network share.
I want to give the ability to the user to allow them to click the file in a listview, for example, and have that file open in WORD or ADOBE or whatever program is associated with that file type.
How would I go about this?
And how about allowing them to click a "hyperlink" in some textbox, for instance, and have that open in IE?
Re: [2008] Copy file to local machine and allow it to open
Use the appropriate event from the ListView to work out which file was clicked and you can open a file of whatever type using;
Code:
System.Diagnostics.Process.Start(FileName)
Instead of specifying a FileName above, this field can also be a web link. You should not force IE, since that may not be the users preferred browser. If you start a process as above with a URL present, it will open the users default browser.
If you want to display some links, a LinkLabel would be better than a TextBox.
Re: [2008] Copy file to local machine and allow it to open
That worked great so far - thanks!
Re: [2008] Copy file to local machine and allow it to open
Quote:
Originally Posted by Bulldog
If you want to display some links, a LinkLabel would be better than a TextBox.
They are textboxes right now because they are bound to dataadapters for maintenance. They don't want "click" to cause them to open - they haven't really told me what key press they prefer yet ;)