Code Snippets

  

VB.NET Source Code


Welcome to Dream.In.Code
Become a VB.NET Expert!

Join 148,690 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 1,657 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: 15,959

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)

XedinUnknown 2008-11-27 06:48:35

Nice! Thanks.


Add comment


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




Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month