Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 363
  • Last Modified:

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!


0
grogo21
Asked:
grogo21
  • 2
  • 2
3 Solutions
 
Pratima PharandeCommented:
use +

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
 
Pratima PharandeCommented:
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 TomlinsonMiddle School Assistant TeacherCommented:
Right..."&" is used for concatenating strings in Visual Basic.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now