Hi everyone,
I am succesfully trying to send an email message through my windows form. The only problem is when i click the button to send mail it is not showing the prograssbar. It shows after a delay or sometimes doesn't show at all.

Is it due to the event handler? I have no clue and all i need to first show is the progressbar when the send button is clicked and then when sending message is successful or unsuccessful then hide progressbar and display the Txtmessage.text.

Any help!!!
Thanx and Cheers
irfi

Code:
Public Sub SendEmail()

        ProgressBar1.Visible = True
        
        Dim client As New SmtpClient()
        Dim sendTo As New MailAddress(To.Text)
        Dim from As MailAddress = New MailAddress("From.Text")
        Dim message As New MailMessage(from, sendTo)

        message.IsBodyHtml = True
        message.Subject = "Hi this is a test"
        
        'for attachement
        Dim att As Attachment = Nothing
        att = New Attachment("c:\attach.pdf")
        message.Attachments.Add(att)

    Dim basicAuthenticationInfo As New System.Net.NetworkCredential(From.Text, TextBox3.Text)
        client.Port = 587

      client.Host = "smtp.gmail.com"
        client.UseDefaultCredentials = False
        client.Credentials = basicAuthenticationInfo
        client.EnableSsl = True

        Try
            client.Send(message)

            ProgressBar1.Visible = False

           TxtMessage.Text  = "Message sent succesfully!"

        Catch ex As Exception

             ProgressBar1.Visible = False

             TxtMessage.Text  = "Message Failed!" 
        End Try

    End Sub
Code:
Private Sub send_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles send.Click

ProgressBar1.Visible = True

Call SendEmail()