Solved

C# Syntax Error

Posted on 2009-03-31
5
352 Views
Last Modified: 2012-06-27
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
Comment
Question by:grogo21
  • 2
  • 2
5 Comments
 
LVL 39

Expert Comment

by:Pratima Pharande
Comment Utility
use +

ReturnStatus.Value = "Error Retrieving Image - " + e.Message.ToString + "  -  " + imgUrl.ToString;
0
 
LVL 3

Accepted Solution

by:
dipakdave1983 earned 150 total points
Comment Utility

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
 
LVL 39

Assisted Solution

by:Pratima Pharande
Pratima Pharande earned 150 total points
Comment Utility
ReturnStatus.Value = "Error Retrieving Image - " + e.Message.ToString() + "  -  " + imgUrl.ToString();
0
 
LVL 3

Expert Comment

by:dipakdave1983
Comment Utility

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
 
LVL 85

Assisted Solution

by:Mike Tomlinson
Mike Tomlinson earned 50 total points
Comment Utility
Right..."&" is used for concatenating strings in Visual Basic.
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now