title: Variables with For..Next Loops
body: <p>My j is the problem. VB is asking me to declare it but thats not what i want. Im trying to add all if not already in a listbox from combo box. And at the end saying how many i have added.</p>
  
  <pre><code>       'Delcare
      Dim bolItemFound As Boolean
      Dim intCounter As Integer
  
      'Adding all items not already listed
      For i = 0 To lstToPackItems.Items.Count - 1
          For j() = 0 To cboStandardToPackItems.Items.Count - 1
              If lstToPackItems.Items.Count &lt; 0 Then
                  lstToPackItems.Items.Add(cboStandardToPackItems.Items)
              End If
              Exit Sub
              If lstToPackItems.Items(i).ToString.ToUpper = cboStandardToPackItems.Items(j).ToString.ToUpper Then
                  bolItemFound = True
              End If
              Exit Sub
          Next
          If bolItemFound = False Then
              'add item
              intCounter += 1
              lstToPackItems.Items.Add(cboStandardToPackItems.Items(j))
              MsgBox("You have successfuly added " &amp; intCounter &amp; " item(s) to your list box!")
          End If
      Next
  </code></pre>