Solved

C# Syntax Error

Posted on 2009-03-31
5
355 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

919 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

20 Experts available now in Live!

Get 1:1 Help Now