Click here to Skip to main content
15,894,896 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Warning The variable is declared but never used how can i avoid this warning ? i tried by adding MessageBox.show(ex.Tostring()); in my code .but when i run the code some commands are displaying as error .please give solution. my coding is in C# .net
Posted
Comments
ShilpaKumari 28-Oct-10 1:26am    
if you will provide your code then question will be easier to understand.

If you have declared a variable but are not using it, then remove it.
That is the only way to get rid of this error.
 
Share this answer
 
Your statement

but when i run the code some commands are displaying as error

If you are declaring variable but not using it then compiler just warn you it doesn't give you any error.

Check your code further for full proof error.
 
Share this answer
 
Please give ur code or elaborate ur question that what variable u have defined unless it would not possible to give a correct solutions of your problem
 
Share this answer
 
Comments
Hiren solanki 28-Oct-10 1:49am    
please put your query below question as a comment, don't use another 10 point answer for that.
Mohd Wasif 28-Oct-10 3:21am    
and what r u doing.if i say u r following
Hiren solanki 28-Oct-10 7:03am    
Please avoid text-speak. and if you intention was to have just code snippets then it could be taken under query to question. and the safe and right place is comment. don't take it to heart, It just my advice before you get some hard hitting votes.

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