Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

OK, I am using vb.net and I have a question regarding the process killing. I was wondering how you kill a process that is curently selected in a listbox. I tried using a list box called lstProcess and

dim Proc as process

Proc = lstProcess.SelectedItem

Kill.Proc

the listbox contains all the currently running process. This did not work and I was wondering how you would approach this. Thanks

  • *Experts*
Posted

You would have to convert the selected item from the listbox to a string and then get that process into your variable using the GetProcessesByName shared method of the process class. The method returns an array so the first member of the array should be good to use.

Dim proc As Process = Process.GetProcessesByName(Convert.ToString(lstProc.SelectedItem))(0)
proc.Kill()

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...