Shoutbox

[solved] Help with code - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: [solved] Help with code (/showthread.php?tid=54085)

[solved] Help with code by Dox on 12-20-2005 at 09:57 AM

ok here is a code for VB.net

code:
Dim proc As Process
proc = Process.GetProcessesByName("name")
proc.Kill()

Now this code should work but when I put this code into an application it sais on the error list
quote:
Value of type '1-dimensional array of System.Diagnostics.Process' cannot be converted to 'System.Diagnostics.Process'.    C:\Documents and Settings\*********\Local Settings\Application Data\Temporary Projects\WindowsApplication1\Form1.vb    5    16    WindowsApplication1

And I have no idea what is going wrong, can anyone help me?
RE: Help with code by Mnjul on 12-20-2005 at 10:16 AM

GetProcessesByName returns not a process but an array of process. As you need to get its elements you'd probably want to write

code:
For Each proc In Process.GetProcessesByName("name")
proc.Kill()
Next

:)
RE: Help with code by Dox on 12-20-2005 at 10:32 AM

Thaks alot Mnjul!