C# Syntax Error

Hello,

what am i doing wrong?

ReturnStatus.Value = "Error Retrieving Image - " & e.Message.ToString & "  -  " & imgUrl.ToString;

I get error:
Operator '&' cannot be applied to operands of type 'string' and 'method group'      

ReturnStatus.Value is a string.

Thanks!


grogo21Asked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
dipakdave1983Connect With a Mentor Commented:

ReturnStatus.Value = "Error Retrieving Image - " +  e.Message.ToString() +  "  -  " + imgUrl.ToString();

1) missing () for toString function
2) use + for concatanation
3) ; semicollon in the last( although you had already in your syntex);
0
 
Pratima PharandeCommented:
use +

ReturnStatus.Value = "Error Retrieving Image - " + e.Message.ToString + "  -  " + imgUrl.ToString;
0
 
Pratima PharandeConnect With a Mentor Commented:
ReturnStatus.Value = "Error Retrieving Image - " + e.Message.ToString() + "  -  " + imgUrl.ToString();
0
 
dipakdave1983Commented:

ReturnStatus.Value = "Error Retrieving Image - " +  e.Message.ToString() +  "  -  " + imgUrl.ToString();

1) missing () for toString function
2) use + for concatanation
3) ; semicollon in the last( although you had already in your syntex);
0
 
Mike TomlinsonConnect With a Mentor Middle School Assistant TeacherCommented:
Right..."&" is used for concatenating strings in Visual Basic.
0
All Courses

From novice to tech pro — start learning today.