title: Syntax error in 'New'
body: <p>I was coding sender of emails in vb.net and it is giving Syntax error. Code below:</p>
  
  <pre><code>Try
          Dim message As New MailMessage With {
          .Subject = Me.SubjectTxt.Text
      }
          message.To.Add(Me.ReceiverTxt.Text)
          message.From = New MailAddress(Me.EmailTxt.Text)
          message.Body = Me.BodyTxt.Text
          Dim num2 As Integer = (Me.AttachmentListbox.Items.Count - 1)
          Dim i As Integer = 0
          Do While (i &lt;= num2)
              Dim item As New Attachment(Conversions.ToString(Me.AttachmentListbox.Items.Item(i)))
              message.Attachments.Add(item)
              i += 1
          Loop
      New SmtpClient(Me.ClientBox.Text) With { _
          .EnableSsl = True, _
          .Credentials = New NetworkCredential(Me.EmailTxt.Text, Me.PasswordTxt.Text), _
          .Port = Conversions.ToInteger(Me.PortTxt.Text) _
      }.Send(message)
      Interaction.MsgBox(("Message sent to " &amp; Me.ReceiverTxt.Text), MsgBoxStyle.Information, "SMTP Email Sender")
      Catch exception1 As Exception
          ProjectData.SetProjectError(exception1)
          Dim exception As Exception = exception1
          If (Me.ReceiverTxt.Text = Nothing) Then
              Interaction.MsgBox("Please fill up the Receiver.", MsgBoxStyle.Exclamation, "You missed something!")
          ElseIf (Me.SubjectTxt.Text = Nothing) Then
              Interaction.MsgBox("Please fill up Subject.", MsgBoxStyle.Exclamation, "You missed something!")
          ElseIf (Me.BodyTxt.Text = Nothing) Then
              Interaction.MsgBox("Please fill up the Message Body.", MsgBoxStyle.Exclamation, "You missed something!")
          ElseIf (Me.EmailTxt.Text = Nothing) Then
              Interaction.MsgBox("Please fill up the Email for Account Log In.", MsgBoxStyle.Exclamation, "You missed something!")
          ElseIf (Me.PasswordTxt.Text = Nothing) Then
              Interaction.MsgBox("Please fill up the Password for Account Log In.", MsgBoxStyle.Exclamation, "You missed something!")
          ElseIf (Me.ClientBox.Text = Nothing) Then
              Interaction.MsgBox("Please fill up the Server for basis of SMTP Server.", MsgBoxStyle.Exclamation, "You missed something!")
          ElseIf (Me.PortTxt.Text = Nothing) Then
              Interaction.MsgBox("Please fill up the Port to successfully send the email.", MsgBoxStyle.Exclamation, "You missed something!")
          Else
              Interaction.MsgBox("Sending Failed", DirectCast(Conversions.ToInteger("SMTP Email Sender"), MsgBoxStyle), Nothing)
          End If
          ProjectData.ClearProjectError()
      End Try
  </code></pre>
  
  <p>The error is in <code>New SmtpClient</code> </p>