如何从列表框中选择所有值

如何从列表框中选择所有值

本文介绍了如何从列表框中选择所有值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请在这里检查我的下面的代码我想从列表框中选择进程名称逐个杀死进程,但我需要从列表框中关闭所有任务,而不选择任何一个只想杀死所有进程点击按钮..所以请你帮助我



提前预付

Dim p As System.Diagnostics.Process

对于 每个 p System.Diagnostics.Process.GetProcesses()

Dim arr() As String = _
lstProcesses.SelectedItem.ToString()。Split( -

Dim sProcess As String = arr( 0 )。修剪()
Dim iId 正如 整数 = Convert.ToInt32(arr( 1 )。Trim())

如果 p.ProcessName = sProcess p.Id = iId 然后
p.Kill()
结束 如果

下一步

解决方案



please check my below code here i want to kill process one by one on selecting the process name from list box, but i need to close all the task from my list box,without select any one just want to kill all the process on button click..so plz can u help me

Thanx in advance

Dim p As System.Diagnostics.Process

For Each p In System.Diagnostics.Process.GetProcesses()

Dim arr() As String = _
lstProcesses.SelectedItem.ToString().Split("-")

Dim sProcess As String = arr(0).Trim()
Dim iId As Integer = Convert.ToInt32(arr(1).Trim())

If p.ProcessName = sProcess And p.Id = iId Then
p.Kill()
End If

Next
解决方案



这篇关于如何从列表框中选择所有值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 19:25
查看更多