Welcome to the forum!

Instead of going through all the processes list you could use the GetProcessesByName() method.

Also, have you made sure that there is actually a process with a ProcessName that matches the one you pass to your killProcess method? You could put a breakpoint inside your For loop and add proc(i).ProcessName to your watch list and check that out.