Ending a process problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Danta
    New Member
    • Feb 2008
    • 1

    Ending a process problem

    Hi all, firstly i'll say im pretty new to vb.net so cut me some slack! I've started working on a small program which lists all the process's in a listview and gives you the option to end it by clicking a button. I've managed to list the process's but what im stuck on is trying to end it. The code i've got in my button is:

    [code=vbnet]

    dim proc as process

    Try
    proc = Process.GetProc essById(Listvie w.SelectedItems (0).Text)
    proc.Kill()
    Catch ex As Exception
    MessageBox.Show (Convert.ToStri ng(ex))
    End Try
    End Sub
    [/code]
    But i get the error "conversion from string "process name" to type Integer is not valid". Any help would be appreciated :-)
    Last edited by Plater; Feb 8 '08, 05:47 PM. Reason: Added [CODE] tags
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    It looks like the SelectedItem.Te xt is giving you the process name, not the process ID, check to make sure you're getting the string you desire first.

    Comment

    Working...