c# - Why am I getting a "Cannot implicitly convert type 'decimal' to 'bool'" error? -


I want to hide some things when the value of the numerical UPDown changes, so I wrote it:

  if (numericUpDown1.Value = 1) {Label1.Hide (); }  

but I receive this error message:

Type can not be changed from 'decimal' to 'bool' Can

Why is this happening?

I think you mean " if (numericUpDown1.Value == 1) ".

In most languages, " == " is a test for equality, while " = " is the assignment operator.


Comments