title: If possible to cotinue a For Each loop after an error jump in VB.NET?
body: <p>I have a BackGroundWorker with a For Each loop that is inside of a Try Catch and I need to detect the error and continue the For Each loop whit the next item.</p>
  
  <p>Actually I have a list of data to send to a server trough UDP and wait for an ACK, but if the server didn't answer in 5 seconds the timeout error is cachet and the whole process is aborted. </p>
  
  <p>I need to do something like this</p>
  
  <pre><code>Dim MyData_Array As String()
  For Each MyData As String In MyData_Array
  
                  MyData_Actual = MyData
                  ' Translate the passed message into ASCII and store it as a Byte array.
                  Dim data As [Byte]() = System.Text.Encoding.ASCII.GetBytes(MyData)
                  Dim RemoteIpEndPoint As New IPEndPoint(IPAddress.Any, 0)
  
  
                  If data.Length = 67 Then
                      XMyData += 1
                      Dim Tx As New UdpClient()
                      Tx.Connect(Host, Port)
                      Tx.Client.SendTimeout = 5000
                      Tx.Client.ReceiveTimeout = 5000
  
                      Tx.Send(data, data.Length)
                      data = Tx.Receive(RemoteIpEndPoint)
  
                      Tx.Close()
                  Else
  
                      MyData_ErrorList += MyData &amp; vbCrLf
  
                  End If
                  'Report progress
                  Porcentaje = (XMyData * 100) / MyData_Array.Count
                  BackgroundWorker1.ReportProgress(Porcentaje, "Sending MyData " &amp; XMyData.ToString &amp; " de " &amp; MyData_Array.Count.ToString &amp; " : " &amp; MyData)
                  If BackgroundWorker1.CancellationPending Then
                      e.Cancel = True
                      Exit For
                  End If
              Next
  
          End If
  
      Catch ex As TimeoutException
          MyData_ErrorList += MyData_Actual &amp; vbCrLf
    '**********************************************************
          'Here need to delay 100mS and get back to the For Each to process the next item
    '**********************************************************
      Catch ex As Exception
  
          MyData_List = ex.Message &amp; vbCrLf &amp; "StackTrace: " &amp; ex.StackTrace &amp; vbCrLf &amp; MyData_List
      End Try
  </code></pre>