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(Con trolId)));
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
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(Con
if ((!(oControlTextbox == null)))
{
oControlTextbox.BackColor = oControlTextbox.BackColor.
oControlTextbox.ForeColor = oControlTextbox.ForeColor.
}
}
}
error message is:
Error 1 Static member 'System.Drawing.Color.Red.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
yes its correct, try it and see the results
ASKER