VB.NET Check if PROCESS is running

Full screen VB.NET Topic list Dim p() As Process Private Sub CheckIfRunning() p = Process.GetProcessesByName("processName") If p.Count > 0 Then ' Process is running Else ' Process is not running End If End Sub Private Function CheckIfRunning(sProcessName As String) As Boolean Dim bRet As Boolean = False Try Dim listProc() As System.Diagnostics.Process listProc = System.Diagnostics.Process.GetProcessesByName(sProcessName) If listProc.Length > 0 Then ' Process is running Else ' Process is not running End If Catch ex As Exception GL.Excep("Frm_Main_SRV.CheckIfRunning", ex) End Try Return bRet End Function 01 Public Function IsProcessRunning(name As String) As Boolean 02 'here we're going to get a list of all running processes on 03 'the computer 04 For Each clsProcess As Process In Process.GetProcesses() 05 If clsProcess.ProcessName.StartsWith(name) Then 06 'process found so it's running so return true 07 Return True 08 End If 09 Next 10 'process not found, return false 11 Return False 12 End Function 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 =============================================== Imports System.Net Imports System.IO If Process.GetProcessesByName("name of process without .extension").Length > 0 Then chekrun = 3 Else chekrun = 10 End If bool processIsRunning = Process.GetProcessesByName("THE NAME OF YOUR PROCSS").Length > 0; =============================================== Copyright © 2015-19 Allied Factors Limited. All Rights Reserved.