Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Get application processID in Visual Studio 2008

Posted on 2009-07-09
6
Medium Priority
?
331 Views
Last Modified: 2013-11-27
I need to get processid from process name.

ex: runing blabla.exe , i want to get PID blabla.exe and write to textbox.
 
0
Comment
Question by:Gknrsy
  • 3
  • 3
6 Comments
 
LVL 53

Expert Comment

by:Dhaest
ID: 24812574
Can you check if this gives what you want
c#-code: System.Diagnostics.Process.GetProcessesByName("process name")[0].Id;System.Diagnostics.Process.GetProcessesByName("process name")[0].Id;
0
 

Author Comment

by:Gknrsy
ID: 24812593
i tried but not working
0
 
LVL 53

Expert Comment

by:Dhaest
ID: 24812603
Did you get an error ?
0
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

Author Comment

by:Gknrsy
ID: 24812615
   If Process.GetProcessesByName("iexplore").Length > 0 Then
            Dim abc As System.Diagnostics.Process = System.Diagnostics.Process.GetProcessesByName("iexplore")[0].Id
            MsgBox(abc.Id)

error: identifier expected
          abc not declared
0
 
LVL 53

Accepted Solution

by:
Dhaest earned 2000 total points
ID: 24812642
2 Solutions :)

1. Dim abc As System.Diagnostics.Process = System.Diagnostics.Process.GetProcessesByName("iexplore")(0)
   MsgBox(abc.Id)

2. Dim abc As Integer = System.Diagnostics.Process.GetProcessesByName("iexplore")(0).Id
0
 

Author Comment

by:Gknrsy
ID: 24812657
Thank you very much :)
0

Featured Post

Learn Veeam advantages over legacy backup

Every day, more and more legacy backup customers switch to Veeam. Technologies designed for the client-server era cannot restore any IT service running in the hybrid cloud within seconds. Learn top Veeam advantages over legacy backup and get Veeam for the price of your renewal

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This article shows how to deploy dynamic backgrounds to computers depending on the aspect ratio of display
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question