title: For loop with If condition - Iteration when if condition not met
body: <p>I have this code where i want this for loop to iterate for each row. But this code get do not iterate when the if condition is false.<br>
  I tried "continue" in else part.But it did not work. Even though if i place a msgbox in else part and click msg box at each time it display then the loop continue. but it is not practical as I have 1000s of rows to check on.  </p>
  
  <pre class="lang-vb prettyprint-override"><code>Public Function SMS()
      CustomerTableAdapter.Fill(MyHotelManagementSystemDataSet63.Customer)
      For i = 0 To MyHotelManagementSystemDataSet63.Customer.Rows.Count - 1
          If MyHotelManagementSystemDataSet63.Customer(i).DOB.Day = Date.Now.Day AndAlso _
              MyHotelManagementSystemDataSet63.Customer(i).DOB.Date.Month = Date.Now.Month Then
              Dim SerialPort As New System.IO.Ports.SerialPort()
              If SerialPort.IsOpen Then
                  SerialPort.Close()
              End If
              SerialPort.PortName = "COM29"
              SerialPort.BaudRate = 9600
              SerialPort.Parity = Parity.None
              SerialPort.StopBits = StopBits.One
              SerialPort.DataBits = 8
              SerialPort.Handshake = Handshake.RequestToSend
              SerialPort.DtrEnable = True
              SerialPort.RtsEnable = True
              SerialPort.NewLine = vbCrLf
              Dim message As String
              Dim nm = MyHotelManagementSystemDataSet63.Customer(i).Name
              Dim tp = MyHotelManagementSystemDataSet63.Customer(i).Telephone
              message = "Dear " + nm + " ***)"
              SerialPort.Open()
              If SerialPort.IsOpen() Then
                  SerialPort.Write("AT" &amp; vbCrLf)
                  SerialPort.Write("AT+CMGF=1" &amp; vbCrLf)
                  SerialPort.Write("AT+CMGS=" &amp; Chr(34) &amp; tp &amp; Chr(34) &amp; vbCrLf)
                  SerialPort.Write(message &amp; Chr(26))
                  SerialPort.Close()
              Else
                  MsgBox("Port not available")
              End If
          Else
  
          End If
      Next
      Return True
  End Function
  </code></pre>
  
  <p>Pleaes help me to make this for loop continue without any user interaction. </p>