Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8145395
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T13:39:00+00:00 2026-06-06T13:39:00+00:00

The exact error I am getting in Visual Studio 2012 is: error BC30456: ‘Dispose’

  • 0

The exact error I am getting in Visual Studio 2012 is:

error BC30456: ‘Dispose’ is not a member of ‘System.Net.Mail.SmtpClient’.

    Dim SmtpServer As New SmtpClient()
    Dim mail As New MailMessage()
    SmtpServer.Port = 25
    SmtpServer.Host = MYHOST.com"
    mail = New MailMessage()
    mail.From = New MailAddress("MYADDRESS@DOMAIN.com")
    mail.To.Add("RECIPIENT@DOMAIN.com")
    mail.Subject = "Test Mail"
    mail.Body = "This is for testing SMTP mail"
    SmtpServer.Send(mail)
    SmtpServer.Dispose()

This should be an obvious error. You would think I was using .net framework 3.5 or lower as Dispose() was only added as a member to SmtpClient in .net 4.0. However, I am using 4.0!

In the website property pages it states 4.0. Is there somewhere else that I need to set as 4.0? Compiler settings somewhere maybe?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T13:39:02+00:00Added an answer on June 6, 2026 at 1:39 pm

    As you’ve observed, you are indeed using the 3.5 version of the System.Net.Mail.SmtpClient.

    To ensure that you’re using version 4:

    • navigate to your project’s references director in Visual Studio
    • delete the reference to System.Net
    • right click, Add Reference
    • find the assembly in the list, as below

    enter image description here

    enter image description here

    Also, consider refactoring your code to have a Using block.

    Using smtp As New SmtpClient()    
       smtp.Port = 25
       'etc etc
    End Using
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting following error while building my vc++ project (Using visual studio 2010)
I'm getting a bunch of failing tests (21 to be exact)/ an error message
The exact error I am getting is First-chance exception at 0x0096234a in chp2.exe: 0xC0000005:
The exact error I'm getting is: Cannot dynamic_cast 'object' (of type 'void*') to type
I am trying to replicate the exact functionality of this dialogue in Visual Studio
The exact error I am getting is: Unknown column 'trans_paid' in 'where clause' My
I am getting this error: The type or namespace name 'AutoMapper' could not be
I have a problem with deserializing in C#/ASP.NET, which gives the exact error: The
The class 'Beans.SidePanelBean' does not have the property getLocation is the exact error. I'm
I am getting compile error candidate function(s) not accessible when calling certain members, although

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.