Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / January 2006

Tip: Looking for answers? Try searching our database.

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

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pieter - 18 Nov 2005 13:33 GMT
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()
Simon - 18 Nov 2005 16:37 GMT
Try using:
    System.Diagnostics.Process.Start(FileName)

> Hi,
>
[quoted text clipped - 31 lines]
>         End Try
>         prcLogin.Close()
td - 19 Jan 2006 23:25 GMT
This works for me!
Thanks Simon
Terry

> Try using:
>      System.Diagnostics.Process.Start(FileName)
[quoted text clipped - 34 lines]
> >         End Try
> >         prcLogin.Close()
Herfried K. Wagner [MVP] - 18 Nov 2005 23:36 GMT
"Pieter" <pietercoucke@hotmail.com> schrieb:
> From my VB.NET 2005 application I need to be able to open Files an
> Directory's with their default application:
[quoted text clipped - 5 lines]
> 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>

Signature

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

Pieter - 21 Nov 2005 08:57 GMT
Thanks Herfried! That was exactly waht I was looking for!

> "Pieter" <pietercoucke@hotmail.com> schrieb:
>> From my VB.NET 2005 application I need to be able to open Files an
[quoted text clipped - 14 lines]
> Displaying the "Open with..." dialog
> <URL:http://dotnet.mvps.org/dotnet/faqs/?id=openwithdialog&lang=en>

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.