opening a document with system's default app

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rubén Cuenca

    #1

    opening a document with system's default app

    Hy, I need to open files by clicking a open button in a form.
    Files would be in any format and I want to open them with system's asociated
    aplication.
    Thanks for your atention.


  • Oenone

    #2
    Re: opening a document with system's default app

    Rubén Cuenca wrote:[color=blue]
    > Hy, I need to open files by clicking a open button in a form.
    > Files would be in any format and I want to open them with system's
    > asociated aplication.[/color]

    Use the UseShellExecute property of a Process object, it'll launch a file
    with whatever application is registered as the default viewer. For example,
    to open a PDF file:

    \\\
    Dim proc As New Process
    'Set the process details
    With proc.StartInfo
    'Set the information for the file to launch
    .FileName = "C:\YourPDFFile .pdf"
    .UseShellExecut e = True
    End With
    'Open the file
    proc.Start()
    ///

    --

    (O)enone


    Comment

    • Cor Ligthert [MVP]

      #3
      Re: opening a document with system's default app

      Ruben,

      Open a document means nothing, a document can be everything. It is a file,
      but it can be a part of a WebPage, a doc file from Word, a part of a table
      in a database etc. etc.

      Can you explain a little bit more what you want?

      Cor

      "Rubén Cuenca" <el_penk@hotmai l.com> schreef in bericht
      news:efwQadJgGH A.4932@TK2MSFTN GP03.phx.gbl...[color=blue]
      > Hy, I need to open files by clicking a open button in a form.
      > Files would be in any format and I want to open them with system's
      > asociated
      > aplication.
      > Thanks for your atention.
      >
      >[/color]


      Comment

      • Herfried K. Wagner [MVP]

        #4
        Re: opening a document with system's default app

        "Rubén Cuenca" <el_penk@hotmai l.com> schrieb:[color=blue]
        > Hy, I need to open files by clicking a open button in a form.
        > Files would be in any format and I want to open them with system's
        > asociated
        > aplication.[/color]


        \\\
        Imports System.Diagnost ics
        ....
        Process.Start(" C:\foo.doc")
        ///

        --
        M S Herfried K. Wagner
        M V P <URL:http://dotnet.mvps.org/>
        V B <URL:http://classicvb.org/petition/>

        Comment

        Working...