Code Snippets

  

VB.NET Source Code


Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 131,846 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,722 people online right now. Registration is fast and FREE... Join Now!





Running an external executable file

This will allow you to start an executable application from within VB.NET. You can also use to open a file with its associated executable (ie. open a .doc file with MS Word)

Submitted By: Jayman
Actions:
Rating:
Views: 14,133

Language: VB.NET

Last Modified: August 9, 2006
Instructions: Make you sure you import the following for this to work:

Imports System.Diagnostics.Process

Snippet


  1. 'make a call to your application or file by giving Process.Start
  2. 'the full path to your file including name and extension.
  3.  
  4. 'will open a Word document called myfile.doc with MS Word
  5. Process.Start("c:\myTestFolder\myfile.doc")
  6.  
  7. 'will run an executable file called myfile.exe
  8. Process.Start("c:\myTestFolder\myfile.exe")
  9.  
  10. 'will open a blank notepad
  11. Process.Start("Notepad.exe")
  12.  
  13. 'I'm sure you get the idea
  14.  

Copy & Paste


Comments


Matthew Blanch 2008-08-18 19:44:23

Thank you so much for this code snippet!!!!! I have been trying to find out how this for a long time and had not found anything. Now i know how to do it! Thank you! Matthew Blanch.

Rozie0910 2008-10-14 01:48:04

i try to open test file on c but i can't could any want help me.. Dim RetVal As String RetVal = Shell("C:\test.exe", 1)


Add comment


You must be registered and logged on to </dream.in.code> to leave comments.





Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month