Link to home
Start Free TrialLog in
Avatar of madina1
madina1

asked on

'System.Drawing.Color.Red.get' cannot be accessed

i have converted code from vb to c# and im getting this error, how do i get rid of this:

 public void ControlToHighlight(string ControlType, string ControlId)
    {
        TextBox oControlTextbox;
        DropDownList oControlDropDown;
        CheckBoxList oCheckBoxList;
        RadioButtonList oRadioButtonList;
        Label oLabel;
        Panel oPanel;
        if (ControlType.Length > 0)
        {
            if (ControlType == "textbox")
            {
                oControlTextbox = ((TextBox)(FindControl(ControlId)));
                if ((!(oControlTextbox == null)))
                {
                    oControlTextbox.BackColor = oControlTextbox.BackColor.Red;   <<<<<<<<error
                    oControlTextbox.ForeColor = oControlTextbox.ForeColor.White; <<<<<<<<error
                }
            }
}


error message is:

Error      1      Static member 'System.Drawing.Color.Red.get' cannot be accessed with an instance reference; qualify it with a type name instead      App_Code\webPagebase.cs      49      50      
 
ASKER CERTIFIED SOLUTION
Avatar of appari
appari
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of madina1
madina1

ASKER

before i post it, i did the exact thing and then i thought im not doing correct so that correct?
yes its correct, try it and see the results