I have a program that check for current running processes and check if blocked processes are running if they do it will end them and ask for password to let you start'em so i added current processes to listbox1 and blocked processes to listbox2 now i want to check if listbox1 contains some of listbox2 items and get list of them and display it in listbox3 which is running blocked processes. my current code: listbox1 = crntprscbox listbox2 = blockedprcsbox
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Processretriever.Start()
For Each OneProcess As Process In Process.GetProcesses
crntprscbox.Items.Add(OneProcess.ProcessName)
Next
End Sub
that's all i have right now i hope i made my question clear if not tell me so i try to describe it more Thanks in advance.
You can use LINQ. This example will find all items in crntprscbox
in common with blockedprcsbox
:
Dim result As List(Of String) = (From s1 As String In Me.crntprscbox.Items Where Me.blockedprcsbox.Items.Contains(s1) Select s1).ToList()
MsgBox( String.Join(Environment.NewLine, result))