Cannot implicitly convert type 'char' to 'bool'
I have the following code:
Code:
if (e.KeyChar = (char)13)
{
SomeFunction(params);
}
When the program complies I get the following error:
Quote:
(231): Cannot implicitly convert type 'char' to 'bool'
Any ideas why that might be? The code is in the following function:
Code:
private void nudWidth_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
which is a Numeric UpDown control.
Dan
Re: Cannot implicitly convert type 'char' to 'bool'
try
Code:
if (e.KeyChar == (char)13)
Because you are not comparing the values with =
Hope that helps
Re: Cannot implicitly convert type 'char' to 'bool'
Haha... yeah, that's it. Thanks.
Dan