Click here to Skip to main content
16,007,126 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
How to rectify this error..


Pls assist me
Posted
Comments
Kenneth Haugland 26-Sep-12 2:57am    
Most likely you forgot to add ToSting() on your metod... Cant really tell without the code though.
bbirajdar 26-Sep-12 3:14am    
Ok.. assisting you. But I can't see anything wrong in the code. I think you should re-install Visual Studio.If it does not work , then format the primary drive and install Visual Studio again..

Add the brackets.

Basically you have said somthing like:
C#
string s= "hello " + myvalue.MyMethod;

where you meant to say:
C#
string s= "hello " + myvalue.MyMethod();

"MyMethod" could be "ToString", "GetSelectedText" or any other method name.
 
Share this answer
 
Operator '+' cannot be applied to operands of type 'string' and 'method group'
This happens when you try to use a method instead of string. Classical mistake done by many is just doing ToString instead of ToString() leading to a method reference instead of a string. Use () to call a method, as in ToString() and convert the object correctly.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900