Tips n Tracks

  • Increase font size
  • Default font size
  • Decrease font size
  • default color
  • black color

Reference

Sample image

Microsoft .NET Framework Get Details.

Sample image

Microsoft .NET Framework Get Details.

Reference

Sample image Microsoft .NET Framework Get Details.
Sample image

Microsoft .NET Framework Get Details.


How we open a File in its Associated Application ?


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.

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.

Comments

No comments yet.

Leave a comment

(required)

(required)

*
To prove that you're not a bot, enter this code
Anti-Spam Image