opening File/Dir with default application (also without extension)

  • Thread starter Thread starter Pieter
  • Start date Start date
P

Pieter

Hi,

From my VB.NET 2005 application I need to be able to open Files an
Directory's with their default application:
- A word-doc must open in word
- A excell-document in Excel etc
- in case it's a folder it must open the Folder

No problem there, but when I want to open a file without extension, that
hasn't offcourse a default application, I'm getting an error. I'd prefer to
have the "Choose Program"-dialog.

Any idea how I should open the files to have this?

Thanks a lot in advance,

Pieter


I'm using this now:



Dim prcLogin As New Process
Try
prcLogin.StartInfo.UseShellExecute = True
prcLogin.StartInfo.RedirectStandardOutput = False
prcLogin.StartInfo.FileName = strName
If strArg <> "" Then
prcLogin.StartInfo.Arguments = strArg
End If
prcLogin.Start()
Catch ex As Exception
MessageBox.Show("Can't open the file!", MessageBoxButtons.OK,
MessageBoxIcon.Error) '-> happens when the file doesn't have an
extension....
End Try
prcLogin.Close()
 
Pieter said:
From my VB.NET 2005 application I need to be able to open Files an
Directory's with their default application:
- A word-doc must open in word
- A excell-document in Excel etc
- in case it's a folder it must open the Folder

No problem there, but when I want to open a file without extension, that
hasn't offcourse a default application, I'm getting an error. I'd prefer
to have the "Choose Program"-dialog.

Opening files, applications, Web documents, and the mail client
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=openfileappwebpage&lang=en>

+

Displaying the "Open with..." dialog
<URL:http://dotnet.mvps.org/dotnet/faqs/?id=openwithdialog&lang=en>
 

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