-
Jan 22nd, 2018, 01:21 PM
#1
Thread Starter
Hyperactive Member
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!
-
Jan 22nd, 2018, 01:44 PM
#2
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.
-
Jan 22nd, 2018, 01:50 PM
#3
Thread Starter
Hyperactive Member
Re: Overload resolution failed
Thanks si the geek
The mail related options show '......is a type and cannot be used as an expression'
-
Jan 22nd, 2018, 02:04 PM
#4
Re: Overload resolution failed
Doe the line
Code:
myMessage.CC.Add(New MailAddress("myemail@mysite.com")) 'Webmaster's assistant
give the same error?
-
Jan 22nd, 2018, 02:08 PM
#5
Thread Starter
Hyperactive Member
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.
-
Jan 22nd, 2018, 02:51 PM
#6
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).
-
Jan 22nd, 2018, 02:56 PM
#7
Thread Starter
Hyperactive Member
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.
-
Jan 23rd, 2018, 11:42 AM
#8
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.
-
Jan 23rd, 2018, 11:43 AM
#9
Thread Starter
Hyperactive Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|