This might be a very common question but I cannot find a proper answer.
Mark this duplicate with the original link if found any..
Say, I have a winform with a button.
And I want to open another application such as say a windows calculator.
so on Button Click, I added this.
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim MyApp As System.Diagnostics.Process = New System.Diagnostics.Process
MyApp.StartInfo.FileName = "C:\Windows\system32\calc.exe"
MyApp.Start()
Dim p() As Process = Process.GetProcessesByName("Calculator")
If p.Count > 0 Then
/*Something like bring that calc to front*/
Else
MyApp.Start()
End If
End If
End Sub
Now I want something like to bring calc to the front if the calc is behind the winform.
If there is no calc open so it'll open new else it'll bring previous one to front.