Skip to content

TechXcel.com - provides technical excellence...

Narrow screen resolution Wide screen resolution Increase font size Decrease font size Default font size default color orange color green color
You are here: Home
How we open a File in its Associated Application? PDF Print E-mail
(1 vote)
Written by Chetankumar Akarte   
Friday, 08 June 2007

How we open a File in its Associated Application?

To open a file in its associated application we have to add namespace to System.Diagnostics.Process to our application. The System.Diagnostics namespace provides classes that allow interacting with system processes, event logs, and performance counters.

Now add below piece of code to any event

Try
   Start(Filename)

Catch ex As Exception
   MsgBox("Trouble starting Application.", MsgBoxStyle.Information, " Application Alert")

End Try

Here we have used Function Start () offer by System.Diagnostics namespace. It Starts a process resource by specifying the name of a document or application file and associates the resource with a new System.Diagnostics.Process component.

Syntax:
Start (ByVal fileName As String)

Parameters:
fileName: The name of a document or application file to run in the process.

Return Values:
A new System.Diagnostics.Process component that is associated with the process resource, or null, if no process resource is started (for example, if an existing process is reused).

Exceptions:
Here is possibility of some exceptions while using start() function those are as follows:

System.ObjectDisposedException: The process object has already been disposed.
System.ArgumentException: The fileName parameter is null.
System.IO.FileNotFoundException: The PATH environment variable has a string containing quotes.
System.ComponentModel.Win32Exception: There was an error in opening the associated file.

submit your Article, Tutorials or FAQs

Hello... if you are interested to submit your Article, Tutorials or FAQs on TechXcel.com - provides technical excellence... mail us at This e-mail address is being protected from spam bots, you need JavaScript enabled to view it

Comments (0)Add Comment

Write comment
You must be logged in to a comment. Please register if you do not have an account yet.

Copyright 2007. All Rights Reserved.
busy




Reddit!Del.icio.us!Google!Live!Facebook!Slashdot!Netscape!Technorati!StumbleUpon!Spurl!Wists!Simpy!Newsvine!Blinklist!Furl!Fark!Blogmarks!Yahoo!Smarking!Netvouz!Shadows!
RawSugar!Ma.gnolia!PlugIM!Squidoo!BlogMemes!FeedMeLinks!BlinkBits!Tailrank!linkaGoGo!
Last Updated ( Friday, 08 June 2007 )
 

Who's Online

User Login

PayPal Donation

Enter Amount:

Syndicate

TechXcel's Friends

Tutorials Garden
Wicolorz
pixel2life

Text Link Add

Statistics

Members: 271
News: 60
Web Links: 6
Visitors: 301012

Google Seach

Google AdSense

TechXcel Referrals

TechXcel's Sponcer...