Solved

C# Syntax Error

Posted on 2009-03-31
5
356 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
ID: 24036035
use +

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

Accepted Solution

by:
dipakdave1983 earned 150 total points
ID: 24036036

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
ID: 24036040
ReturnStatus.Value = "Error Retrieving Image - " + e.Message.ToString() + "  -  " + imgUrl.ToString();
0
 
LVL 3

Expert Comment

by:dipakdave1983
ID: 24036046

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
ID: 24036178
Right..."&" is used for concatenating strings in Visual Basic.
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

786 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