Re: Split Function

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I take it you have another closing curly brace at the end of your code
as there appears to be one missing from here.

Also, what exactly is your error?


sck10 wrote:
Hello,

I have a list of email addresses that I need to send email to from the
website. I am trying to use the "Split" function to get all the To's and
then use the uBound function for the For-Loop limit:

I am trying to convert the following from vb to c#:

Dim SplitCatcher As Object
SplitCatcher = Split(To, ",")

Dim i As Integer
For i = 0 To UBound(SplitCatcher)
If Len(SplitCatcher(i)) > 0 Then objMM.To.Add(SplitCatcher(i))
Next

to

string[] SplitCatcher = Split(To, ",");
for (int i = 0; uBound(SplitCatcher); i++)
{
if (SplitCatcher[i].Length > 0) MM.To.Add(SplitCatcher[i]);
}



Mail Code
====================
public void SendWebMail(string From, string To, string Subject, string Body,
string Client)
{
//Build Email List
MailMessage MM = new MailMessage();
MailAddress AddrFrom = new MailAddress(From);

// build recipient list
//MailAddress AddrTo = new MailAddress(To);
string[] SplitCatcher = Split(To, ",");
for (int i = 0; uBound(SplitCatcher); i++)
{
if (SplitCatcher[i].Length > 0) MM.To.Add(SplitCatcher[i]);
}

MM.Subject = Subject;
MM.Body = Body;
SmtpClient scMail = new SmtpClient(Client);
scMail.Send(MM);

} //End void SendMail

.



Relevant Pages

  • Re: Is there a limit to the size or complexity of JPanels paintComponent method?
    ... double actualnorthextent, actualsouthextent, actualwestextent, ... public void movemapdown() ... public double convertstringcoordinatetodouble(String coord) ... return screencoords; ...
    (comp.lang.java.gui)
  • Re: Is there a limit to the size or complexity of JPanels paintComponent method?
    ... double actualnorthextent, actualsouthextent, actualwestextent, ... public void movemapdown() ... public double convertstringcoordinatetodouble(String coord) ... return screencoords; ...
    (comp.lang.java.gui)
  • Re: Problem with FTP
    ... > private static Encoding ASCII = Encoding.ASCII; ... > private string message = null; ... > private int port = 21; ... > public void Login() ...
    (microsoft.public.pocketpc.developer)
  • Re: All Menu Navigation
    ... i based the implementation on sample code from http://www.asp.net/CSSAdapters/Menu.aspx, which shows how to create decent HTML for a Menu control bound to a SiteMapDataSource. ... public void RenderBeginTag(HtmlTextWriter writer, string cssClass) ... static public void RemoveProblemTypes ...
    (microsoft.public.dotnet.framework.aspnet)
  • Getting Error in Login() method in FtpConnection Class
    ... private static int BUFFER_SIZE = 512; ... private static Encoding ASCII = Encoding.ASCII; ... private string server = "localhost"; ... public void Login() ...
    (microsoft.public.dotnet.languages.csharp)