Home All Groups Group Topic Archive Search About

opening a document with system's default app

Author
26 May 2006 7:40 AM
Rubén Cuenca
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.

Author
26 May 2006 10:04 AM
Oenone
Rubén Cuenca wrote:
> 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.

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"
        .UseShellExecute = True
    End With
    'Open the file
    proc.Start()
///

--

(O)enone
Author
26 May 2006 10:13 AM
Cor Ligthert [MVP]
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

Show quoteHide quote
"Rubén Cuenca" <el_p***@hotmail.com> schreef in bericht
news:efwQadJgGHA.4932@TK2MSFTNGP03.phx.gbl...
> 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.
>
>
Author
26 May 2006 11:38 AM
Herfried K. Wagner [MVP]
"Rubén Cuenca" <el_p***@hotmail.com> schrieb:
> 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.


\\\
Imports System.Diagnostics
....
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/>