Search - Articles
DevASP.NET for ASP.NET, VB.NET, XML and C# (C-Sharp) Developers Tuesday, March 03, 2009
Dev Articles
Search Directory
ASP.NET
VB.Net
C-Sharp
SQL Server
 

FREE 12 month online training for ASP.NET & MS Expression Studio and a Free copy of MS Expression Web with Windows Server Purchase
How to open other Applications Using VB.Net Application.

Author: DevASP
Download Source Code : 350_Other_applications.zip

A tip that will show you how you can execute multiple applications from one application using Visual Basic.Net.

Create New Project in VB.net. Four Button control from tool box and place on form having text calculator, Excel, notepad, paint and your own application.

 

Now write code on Buttons Click events:

 

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

 

        Dim p As New System.Diagnostics.Process

        p.StartInfo.FileName = "Calc.exe"

        p.Start()

 

End Sub

 

 

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

 

        Dim p As New System.Diagnostics.Process

        p.StartInfo.FileName = "Notepad.exe"

        p.Start()

 

End Sub

 

 

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

 

        Dim p As New System.Diagnostics.Process

        p.StartInfo.FileName = "Excel.exe"

        p.Start()

 

End Sub

 

 

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

       

   Dim p As New System.Diagnostics.Process

   p.StartInfo.FileName = "Mspaint.exe"

   p.Start()

 

End Sub

 

 

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click

 

        If p.StartInfo.FileName <> "" Then

            p.Close()

        End If

        p.StartInfo.FileName = "name.exe"

        p.Start()

 

End Sub

 

 

Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing

 

        p.Kill()

 

End Sub

 

 

Button5 is opening a application name.exe which is resided in the program’s Bin folder and exit when new program start OR close the current program.

Article Comments
Thanks for this article. However, need more detail, how do you open the a passworded file (say passworded word document) from vb.net. Thanks

Posted on 12/13/2006 5:57:35 AM by gab

I would sincerely appreciate some help around using process.start to open a specific passworded mdb file. I have used the code below but keep getting "file not a Win32 executable file".

Any help would be appreciated.

Regards

Code
=======
Function trpw(ByVal str As String)

Dim password As New Security.SecureString

For Each c As Char In str.ToCharArray

password.AppendChar(c)

Next


Return password

End Function



Private Sub

Dim fpath As String ="somepath\sample.mdb"
Dim myProcess As New System.Diagnostics.Process

myProcess.StartInfo.UseShellExecute = False
myProcess.StartInfo.FileName = fpath
myProcess.StartInfo.Verb = "open"
myProcess.StartInfo.CreateNoWindow = True
myProcess.StartInfo.Password = trpw("somepassword")
myProcess.Start()

end sub

Posted on 12/13/2006 11:17:43 PM by gab

it is nice program to open other application from vb.net, but i need to know the executable file name for other application



i opened the notepad but i don't know to set the typing mode in notepad to type in from runing vb.net programming

Posted on 12/30/2006 1:09:59 AM by kalaivani

Dear .. i can able to create a vb.net application using MS word document. After complete that operation I cant able to close the (Word.Application). But i had closed the backend running process.If i click second time . the Process will show an error message . can any one can help me. Please this is very urgent.

Posted on 1/22/2007 7:07:50 AM by Ramesh

Is there a way to send the process back to a control on the main page rather than having it open it's own window. I was mainly trying to figure out how to use the shimgvw.dll (Windows Image and Fax Viewer) to display images because the ActiveX control does not do what I want it to yet making a process call does.

Posted on 3/30/2007 2:36:13 PM by Roger

Nice article! But I wish to give one more suggestion if somebody wants to open some other application like netbeans 5.5, sometime we may have to specify the whole path.
"C:\Program Files\netbeans-5.5\bin\netbeans.exe"

Posted on 4/15/2007 11:38:25 PM by Jeyakanthan

Hi,
Nice work. i need to develop an application which reads data from an excel file and opens one non windows application and enters the data appropriately according to my requirement. I can do the first part which is easy to read data from an excel file . but the second one is very difficult for me . kindly help me to develop this application. thanks in advance

Posted on 1/30/2010 5:54:14 AM by Jeganath

Is there a way to open the application within a vb form?
I mean I know how to launch the application but it always appear in a different windows
But if anyone knows how to do it WITHIN the form , that is..I want for e.g word to launch ms-word inside my form...
how to do that?

Posted on 3/14/2010 9:12:23 AM by Luc

Thanks for this article. However, need more detail

Posted on 5/11/2010 5:32:38 AM by nikki

   
Add Article Comment:
Name :
Email Address :
   
Comments :
 
   
<< How to Make DLL Using Visual Basic.Net (Part3)

Disclaimer - Privacy
© 2002-2014 DevASP.net