Results 1 to 9 of 9

Thread: Overload resolution failed

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    469

    Overload resolution failed

    Hello

    In VS 2013, I get the following blue underline under New MailAddress:

    Code:
    Dim CC As MailAddress = New MailAddress
    Error: Overload resolution failed because no accesible 'New' accepts this number of arguments

    I am not able to copy in a message using

    Code:
    myMessage.CC.Add(New MailAddress("myemail@mysite.com")) 'Webmaster's assistant
    so I am just trying different things. What does that error mean, please? Any way around it?

    Thanks!

  2. #2
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Overload resolution failed

    It is possible to have multiple subs (or functions) with the same name, as long as they have different parameters. This is known as Overloading, and is useful in various situations (eg: the MessageBox.Show function has multiple overloads, so you don't have to specify a window title if you only want to set the message text).

    In this case you are indirectly calling a sub (sub New for the MailAddress class), but the parameters you have specified (in this case: none) do not match any of the Overloads of that sub... so you need to change the parameters you use.

    If you simply add an open-bracket to the end of MailAddress like this:
    Code:
    Dim CC As MailAddress = New MailAddress(
    ...you should get a list of the valid overloads displayed (you may need to click arrows to view the different ones), and can pick one that is appropriate for your situation, then specify appropriate parameters for it.

    In this case I suspect you can copy+paste what you want from the second block of code in your own post.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    469

    Re: Overload resolution failed

    Thanks si the geek

    The mail related options show '......is a type and cannot be used as an expression'

  4. #4
    PowerPoster PlausiblyDamp's Avatar
    Join Date
    Dec 2016
    Location
    Pontypool, Wales
    Posts
    2,458

    Re: Overload resolution failed

    Doe the line
    Code:
    myMessage.CC.Add(New MailAddress("myemail@mysite.com")) 'Webmaster's assistant
    give the same error?

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    469

    Re: Overload resolution failed

    No, there is no error in VS, but the person copied in does not receive a message (the Webmaster does). In the Webmaster's inbox, I can see:

    TO: email of Webmaster
    CC: email of assistant

    but the assistant himself does not receive a copy of the Webmaster's message.

  6. #6
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,929

    Re: Overload resolution failed

    As that line doesn't give you an error, the change I suspected is the way to go:
    Code:
    Dim CC As MailAddress = New MailAddress("myemail@mysite.com")
    However, this is unlikely to help solve the issue with the email not arriving - that is most likely not due to code, but something like the address being wrong (check carefully for typos), the email client doing something with it (check the spam folder), or the email server not transmitting it (ask the server admin to look into it).

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    469

    Re: Overload resolution failed

    Thanks, si the geek. I will ask the Web hosting service.

    The email address is correct: it's my own Microsoft address.

  8. #8
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,393

    Re: Overload resolution failed

    It is possible that Microsoft is helpfully deleting that spam from your e-mail. You could try white-listing that e-mail address in your Microsoft e-mail.

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 2014
    Posts
    469

    Re: Overload resolution failed

    Thanks jdc2000

    I will replace it with another email and see what happens.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width