Click here to Skip to main content
15,907,329 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hello when i execute i get the error like

Cannot implicitly convert type 'void' to 'bool

here is my code :-
bool blnResult = objMail.SendMail(ConfigurationManager.AppSettings["supportEmail"].ToString(), strFromMail, "Query from Live Help", strMailString);


Help Me..!!
Posted
Updated 28-May-19 10:17am

hello
your problem occur following problem:-
your
C#
SendMail(ConfigurationManager.AppSettings["supportEmail"].ToString(), strFromMail, "Query from Live Help", strMailString);
function return type is void that's why it can not be converted into bool .first check its return type and if its type is void than change it into bool and
return either true/false.


i hope your problem will solve if not please give me your comments.
 
Share this answer
 
v2
Comments
_Amy 14-Jul-12 3:35am    
Added pre tag.
Yatin chauhan 14-Jul-12 5:48am    
hello rizwan muhammed khan and AK . no i get that function Sendmail its return type if void so , now me change that bool and error solved.
Thax to so much ..........

have a nice day
Hi,

Quote:
bool blnResult = objMail.SendMail(ConfigurationManager.AppSettings["supportEmail"].ToString(),


replace above statement with this..

bool blnResult = Convert.ToBoolean(objMail.SendMail(ConfigurationManager.AppSettings["supportEmail"].value.ToString(), strFromMail, "Query from Live Help", strMailString));


even if you are getting the same error, then may be due to Email CLient object.

hope it helps.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900