O`right, this will do it:
Public Sub New()
InitializeComponent()
listBox1.Items.AddRange(New Object() {2, 2, 2, 3, 13})
End Sub
Private Sub button2_Click(sender As Object, e As EventArgs)
Dim list As New List(Of Integer)()
For i As Integer = 0 To listBox1.Items.Count - 1
Dim value1 As Integer = Integer.Parse(listBox1.Items(i).ToString())
For j As Integer = i + 1 To listBox1.Items.Count - 1
Dim value2 As Integer = Integer.Parse(listBox1.Items(j).ToString())
If value1 = value2 Then
list.Add(value1)
RemoveItems(value1, i, j)
End If
Next
Next
'for the end, you do the math operations over the values:
Dim result1 As Integer = 1
For Each number As Integer In list
result1 *= number
Next
Dim result2 As Integer = 1
For i As Integer = 0 To listBox1.Items.Count - 1
result2 *= Integer.Parse(listBox1.Items(i).ToString())
Next
MessageBox.Show("Variable 1 = " & result1 & vbLf & "Variable 2 = " & result2)
End Sub
Private Sub RemoveItems(value As Integer, a As Integer, b As Integer)
For i As Integer = 0 To listBox1.Items.Count - 1
If i = a Then
listBox1.Items.RemoveAt(a)
ElseIf i = b Then
listBox1.Items.RemoveAt(b)
End If
Next
End Sub
Let me know if its working (it does here).