Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have this simple for each loop

 

For each row as datarow in dtResults.rows

' Send the email

Next

 

Now I dont want to send the email everytime based on the value in one of the columns in dtResults, so I need

 

For each row as datarow in dtResults.rows

If row.item(0).tostring = "" then

Next

End If

 

' Send the email

Next

 

However this will not compile, it there anyway I can call the next in two different places based on logic?

 

Thanks

Posted (edited)

Continue

 

The keyword you are looking for is Continue:

 

For Each row As DataRow In dtResults.Rows
   If (row.Item(0).ToString = "") Then Continue For

   ' Send the email
Next

 

Good luck :)

Edited by MrPaul
Never trouble another for what you can do for yourself.
Posted

That seems awkward. Why not...

 

For Each row as datarow in dtResults.Rows
  If row.item(0).tostring <> "" Then  ''If it's a good row for sending an email
     'send the email
  End If
Next

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...