-1

Visual Studio 2012 complains about comparing two Brushes:

private void SetLabel(string stText, Brushes colorBackground)
{
  if (colorBackGround == Brushes.Yellow)
 ...
}

Error message: "The name 'colorBackGround' does not exist in the current context"

Nathan Hughes
  • 94,330
  • 19
  • 181
  • 276
bhs67
  • 29
  • 4
  • you didn't declare colorBackGround or didn't include files/units properly – Marco A. Feb 21 '14 at 15:32
  • `Visual Studio 2012 complains` - your code is wrong. It's not the fault of the IDE S: – Federico Berasategui Feb 21 '14 at 15:32
  • Sorry about the colorBackground typo -> I had fixed it but did not copy it correctly -> too much muxing. The correct error message is "Operator '==' cannot be applied to operands of type 'System.Windows.Media.Brushes' and 'System.Windows.Media.SolidColorBrush'" I tried changing Brushes colorBackground to SolidColorBrush colorBackground -> it is satisfied with the "if" statement, but does not like gLBl.Background = colorBackGround -> assumed changing it to SolidColorBrush was a mistake. – bhs67 Feb 21 '14 at 16:08

1 Answers1

0

colorBackGround is not the same as colorBackground! C# is case sensitive

Michael
  • 1,557
  • 2
  • 18
  • 38