Reading Flat file in VB.NET

Below example will help you Reading flat file in VB.Net.

Using myReader As New Microsoft.VisualBasic.FileIO.TextFieldParser("C:\test.txt")
      myReader.TextFieldType = FileIO.FieldType.Delimited
      ' In this case data in flat file are separated by pipe("|").
      Dim currentRow As String()
      While Not myReader.EndOfData
             currentRow = myReader.ReadFields()
             Dim currentField As String
             For Each currentField In currentRow
          Catch ex As Microsoft.VisualBasic.FileIO.MalformedLineException
                MsgBox("Line " & ex.Message & "is not valid and will be skipped.")
          End Try
      End While
End Using

Sending email from ASP.NET

Sending Email from an ASP.NET web application is a simple task.

For sending Email from ASP.NET web application we need to add one namespace,

using System.Net.Mail;

After this we can create a method , sendEmail().

public void sendEmail()
                    MailMessage message = new MailMessage();
                    message.From = new MailAddress("");
                    message.To.Add(new MailAddress(""));
                    message.Subject = "Sending an email from ASP.NET web application";
                    message.Body = "Your Email Content here…";
                    SmtpClient client = new SmtpClient();
                    client.Host = "Give your mail server IP";
                    client.Port = Put port number;
                    client.Send(message );

You can use this function anywhere from application.