Results 1 to 4 of 4

Thread: [RESOLVED] [2008] Copy file to local machine and allow it to open

  1. #1

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Resolved [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?

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  2. #2
    Frenzied Member
    Join Date
    Jun 2005
    Posts
    1,950

    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.
    Last edited by Bulldog; Feb 15th, 2009 at 04:33 PM.

  3. #3

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    Re: [2008] Copy file to local machine and allow it to open

    That worked great so far - thanks!

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

  4. #4

    Thread Starter
    MS SQL Powerposter szlamany's Avatar
    Join Date
    Mar 2004
    Location
    Connecticut
    Posts
    18,263

    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

    *** Read the sticky in the DB forum about how to get your question answered quickly!! ***

    Please remember to rate posts! Rate any post you find helpful - even in old threads! Use the link to the left - "Rate this Post".

    Some Informative Links:
    [ SQL Rules to Live By ] [ Reserved SQL keywords ] [ When to use INDEX HINTS! ] [ Passing Multi-item Parameters to STORED PROCEDURES ]
    [ Solution to non-domain Windows Authentication ] [ Crazy things we do to shrink log files ] [ SQL 2005 Features ] [ Loading Pictures from DB ]

    MS MVP 2006, 2007, 2008

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width