Open registered file from Windows form

  • Thread starter Thread starter Rabbit
  • Start date Start date
R

Rabbit

Dear All,

I can't find the solution from MSDN about how to use vb.net to do same
function as double clicking an registered file type file in Windows
Explorer. In order to execute such file automatically, I don't want to
hardcode my program to use Shell function which need to define the
associated application for opening the file like following example:

Shell("word.exe test.doc", AppWinStyle.NormalNoFocus, False)

Does anybody know the function to do this?

Thanks for help
Keith
 
The code below should help out:

Imports System.Diagnostics

' Code to open the file.
Dim info As New ProcessStartInfo("C:\Test.doc")
Dim proc As New Process
proc.StartInfo = info
proc.Start()
 
Works perfect! Thank you so much
Tim Wilson said:
The code below should help out:

Imports System.Diagnostics

' Code to open the file.
Dim info As New ProcessStartInfo("C:\Test.doc")
Dim proc As New Process
proc.StartInfo = info
proc.Start()
 
* "Rabbit said:
function as double clicking an registered file type file in Windows
Explorer. In order to execute such file automatically, I don't want to
hardcode my program to use Shell function which need to define the
associated application for opening the file like following example:

Shell("word.exe test.doc", AppWinStyle.NormalNoFocus, False)

\\\
Imports System.Diagnostics
..
..
..
Dim psi As New ProcessStartInfo()
psi.UseShellExecute = True
psi.FileName = "C:\bla.html"
Process.Start(psi)
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top