azebiak Posted February 21, 2004 Posted February 21, 2004 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 Quote
*Experts* mutant Posted February 21, 2004 *Experts* Posted February 21, 2004 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() Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.