Click here to Skip to main content
15,917,793 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
//here i have declared color

private static System.Drawing.Color _ErrorMessageLabelForeColor = System.Drawing.Color.red;



public static color ErrorMessageLabelForeColor
       {
           get
           {
         // here displays error "cannot implicitly convert type System.Drawing.Color"
               return _ErrorMessageLabelForeColor;
           }

                     set { _ErrorMessageLabelForeColor = value; }
       }
Posted

Another possible solution (in the case the letter casing is locorrect in the original code) -
public static Color ErrorMessageLabelForeColor

Here Color may actually be System.Windows.Media.Color and it is not the same as System.Drawing.Color.
In this case you should either change all your colors to System.Drawing.Color or to System.Windows.Media.Color or perform conversion inside your property getter and setter.
 
Share this answer
 
Case, my freind, case:
public static color ErrorMessageLabelForeColor
is not the same as
public static Color ErrorMessageLabelForeColor
 
Share this answer
 
Comments
ken A to Z 15-Jul-11 12:14pm    
really thanks

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