David C wrote:
> I am getting an exception error whenever the code below goes into the
> For...Next loop. Can anyone spot what I am doing wrong? Also, the
> txtEmailTo.Text has email addresses and if more than 1 they are separated by
> a semicolon. Thanks.
> David
>
> Dim mm As New MailMessage()
>
> '(2) Assign the MailMessage To and From properties
> 'Note that mm.To is a collection so that multiple people can be
> emailed.
> If InStr(txtEmailTo.Text, ";") > 0 Then
> 'Dim strEmailTo() = ""
> Dim strTo As String
> For Each strTo In Split(";", txtEmailTo.Text)
> mm.To.Add(strTo)
> Next
> Else
> mm.To.Add(txtEmailTo.Text)
> End If
>
>
You should be using:
for each strTo in Split(txtEmailTo.Text, ";")
--
Mike
|