CS0029: Cannot implicitly convert type 'void' to 'object'

Posted by perfectchourasia-9163 under ASP.NET on 11/21/2011 | Points: 10 | Views : 2017 | Status : [Member] | Replies : 1
if (Page.IsValid)
{
string from = "sandeepchrs@yahoo.com";
string to = txtemailto.Text.ToString().Trim();
string subject = txtmailsubject.Text.ToString().Trim();
string body = txtemailmsg.Text.ToString().Trim();
string filename = Path.GetFileName(FileUpload1.FileName);
string fileAttach = FileUpload1.SaveAs(Server.MapPath("Attachement") + "\\" + filename); ;
sendmail.SendMailMessage(from, to, subject, body, fileAttach);

}

ER sandeep chourasia
sandeepchrs@yahoo.com (on facebook)
http://www.aspnetcodes.com/



Responses

Posted by: Blessyjees on: 11/21/2011 [Member] Bronze | Points: 25

Up
0
Down
Hi,

Fileupload1.SaveAs(..) does not return any value. If you remove "string fileAttach=" it will working properly.

Blessy Baby
Digitalmesh Softech pvt Ltd
https://blessybaby.wordpress.com/

perfectchourasia-9163, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response