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.
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.
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" & vbCrLf)
SerialPort.Write("AT+CMGF=1" & vbCrLf)
SerialPort.Write("AT+CMGS=" & Chr(34) & tp & Chr(34) & vbCrLf)
SerialPort.Write(message & Chr(26))
SerialPort.Close()
Else
MsgBox("Port not available")
End If
Else
End If
Next
Return True
End Function
Pleaes help me to make this for loop continue without any user interaction.