title: Loop through a string to find the odd numbers VB
body: <p>I am looping through a card number finding all the odd numbers and multiplying them by the card digits. Its kind of hard to explain. I am having trouble multiplying the odd number and the card number. Here's an example my teacher gave me. You multiply card number 1 and and odd number 1 and so forth. I am not getting any errors, it just kind of freezes.</p>
  <pre><code>Sums        
  Card #:     1   2   3   4   5   6   7   8   9   0   1   2   3   4   5   6           
  Multiples   1       2       3       4       5       6       7       8               
  Evens:      2       4       6       8       0       2       4       6   32  =Sum 1  
  Odds:       1       6       15      28      45      6       21      40  162 =Sum 2  
  </code></pre>
  <pre><code>Sum 3:  194                                                             
  194 =Sum 3  
  Step 4: =1+9+4 = 14                                                                     
  = 1 + 4 = 5 = check digit
  </code></pre>
  <pre><code>Public Class Payment
  Private Sub OK_Click(sender As Object, e As EventArgs) Handles OK.Click
      Dim Sum1 = 0
      Dim Sum2 = 0
      Dim Sum3 = 0
      Dim ready As Boolean
      Dim ccnumb = CardNumber.Text
      Format(CardNumber.Text, &quot;################&quot;)
      Dim exp = Mid(ExpDate.Text, 1, 3)
      Dim checkdigit = 0
      If FullName.TextLength = 0 Or cardtype.Text.Length = 0 And ccnumb.Length &lt;= 16 Or exp.Length = 2 Then
          MessageBox.Show(&quot;Please enter all credit card information before proceeding.&quot;)
          ready = False
      Else ready = True
      End If
      If ready = True Then
          For Each num As Char In ccnumb
              If CInt(CStr(num)) Mod 2 &lt;&gt; 0 Then
                  Sum1 += CInt(CStr(num)) * CInt(CStr(num)) Mod 2 &lt;&gt; 0
              Else
                  Sum2 += CInt(CStr(num))
              End If
          Next
  
          Sum3 = Sum1 + Sum2
          Do While Sum3 &gt; 10
              For j = 0 To Sum3.ToString.Length - 1
                  For k = 1 To Sum3.ToString.Length - 1
                      Sum3 = j + k
                  Next
              Next
          Loop
          Do While exp.Length &gt; 1
              checkdigit = Mid(ExpDate.Text, 1, 1) + Mid(ExpDate.Text, 1, 2)
          Loop
          If Sum3 = checkdigit Then
              MessageBox.Show(&quot;Congratulations! Your payment was successful.&quot;)
              CustInv.Show()
          Else MessageBox.Show(&quot;The checkdigit,&quot; &amp; Space(1) &amp; Sum3 &amp; Space(1) &amp; &quot;does not match the month code,&quot; &amp; Space(1) &amp; checkdigit &amp; &quot;.&quot; &amp; Space(1) &amp; &quot;Please reenter your card information.&quot;)
          End If
      End If
  End Sub
  </code></pre>