0

how to check the application is already running using vb.net,if the application is running switch to that application how to do that using vb.net..?

Please help me

Thanks in advance..

Public Function IsProcessRunning(ByVal name As String) As Boolean For Each clsProcess As Process In Process.GetProcesses() If clsProcess.ProcessName.StartsWith(name) Then Return True End If Next Return False End Function Private Sub adxcmbSwitchtoDLtool_Click(ByVal sender As System.Object) Handles adxcmbSwitchtoDLtool.Click Dim path As String = "D:\SRIVANI\DLEWISSCM\DictaSolicitor\bin\Debug\DictaSolicitor.EXE" If IsProcessRunning(path) = True Then Else Process.Start(path) End If end sub 

i wrote code like that if i click on the button my application is open and again i click on the button again my application is running..how many times i click the button those many times the application is running how to check the opened application and switch to the application............

3
  • 1
    Possible duplicate of stackoverflow.com/questions/391339/… Commented Jul 18, 2013 at 13:12
  • 1
    Overview of the Visual Basic Application Model: "The Visual Basic Application model makes it easy to create a single-instance application. A single-instance application differs from a normal application in that only one instance of the application can be running at a time. An attempt to launch another instance of a single-instance application results in the original instance being notified ..." Commented Jul 18, 2013 at 13:12
  • @Srivani: Please edit that code into your question. Commented Jul 18, 2013 at 15:22

1 Answer 1

5

Just enable the "Make single-instance application" checkbox in your application properties.

Sign up to request clarification or add additional context in comments.

2 Comments

while enable the "Make single-instance application" checkbox in my application properties,i am getting the following error..startup object must be a form when "Enable application framework" is checked.how to resolve it through coding.......please help me..
i make the application is single instance application but still i am facing the same problem,how to resolve it..

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.