'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      
 
madina1Asked:
Who is Participating?
 
appariCommented:
try changing

oControlTextbox.BackColor = oControlTextbox.BackColor.Red;   <<<<<<<<error
oControlTextbox.ForeColor = oControlTextbox.ForeColor.White; <<<<<<<<error

to

oControlTextbox.BackColor = System.Drawing.Color..Red;  
oControlTextbox.ForeColor = System.Drawing.Color..White;
0
 
madina1Author Commented:
before i post it, i did the exact thing and then i thought im not doing correct so that correct?
0
 
appariCommented:
yes its correct, try it and see the results
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.