opening a document with system's default app

  • Thread starter Thread starter Rubén Cuenca
  • Start date Start date
R

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.
 
Rubén Cuenca said:
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()
///
 
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 said:
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")
///
 
Back
Top