Hello @M Indra Ruslan
The following has a Timer enable, checks to see if an executable is running or not and sets the ProgressBar visible accordingly. The ProgressBar.Style is Marquee in this case. I tested this with an executable running and then stopped then started etc. The executable name is ChunkIncoming.exe residing in the following folder C:\Dotnetland\SIDES MPC.
Of course you can alter the logic in regards to .Visible to set the .Value and keep the ProgressBar visible rather than hide the progress bar.
Public Class Form1
Private Const ExecutablePath As String = "C:\Dotnetland\SIDES MPC"
Private Const ExecutableBaseName As String = "ChunkIncoming"
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Dim process() As System.Diagnostics.Process = System.Diagnostics.Process.GetProcessesByName(ExecutableBaseName)
If process.FirstOrDefault() Is Nothing Then
ProgressBar1.Visible = False
Else
Dim test = process.FirstOrDefault(Function(p) p.MainModule.FileName.StartsWith(ExecutablePath))
If test.HasExited Then
ProgressBar1.Visible = False
Else
If Not ProgressBar1.Visible Then
ProgressBar1.Visible = True
End If
End If
End If
End Sub
End Class
Keep ProgressBar visible, show 100 percent done
Public Class Form1
Private Const ExecutablePath As String = "C:\OED\Dotnetland\SIDES MPC\Debug"
Private Const ExecutableBaseName As String = "ChunkIncomingTextFile"
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
Dim process() As Process = Diagnostics.Process.GetProcessesByName(ExecutableBaseName)
If process.FirstOrDefault() Is Nothing Then
ProgressBar1.Visible = False
Else
Dim test = process.FirstOrDefault(Function(p) p.MainModule.FileName.StartsWith(ExecutablePath))
If test.HasExited Then
ProgressBar1.Style = ProgressBarStyle.Blocks
ProgressBar1.Value = 100
Timer1.Enabled = False
Else
If Not ProgressBar1.Visible Then
ProgressBar1.Visible = True
End If
End If
End If
End Sub
End Class