I have two listboxes (1: Primary, 2:Secondary). These listboxes contain numbers. The Primary Listbox contains 7 numbers, and the Secondary Listbox contains 6 numbers.
I want to compare the values of the Primary Listbox to those of the Secondary. This comparison should yield three results:
Result #1: X number of values were found to be common.
Result#2: All numbers matched.
Result#3: No matches found.
This is what I have so far:
Note: I`m only dealing with integer values in the two listboxes.Code:If lstPrimaryNumbers.Items.Count = 0 Or lstSecondaryNumbers.Items.Count = 0 Then MessageBox.Show("There is nothing to compare.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error) End If Dim r = lstPrimaryNumbers.Items.Cast(Of String).Where(Function(x) lstSecondaryNumbers.Items.Contains(x)) MessageBox.Show(String.Join(",", r) & " matched")




Reply With Quote
