Operator '==' cannot be applied to operands of type 'char' and 'string'

后端 未结 1 617
不知归路
不知归路 2021-01-14 11:30

I have a registration application which has the \"KeyChar\" event inside it, and it works great ! but when i give the same lines of code in this application it gives me

1条回答
  •  情书的邮戳
    2021-01-14 11:46

    Use the character. Single quotes ' define a character, while double quotes " define a string:

    if (e.KeyChar == 'L')
    

    0 讨论(0)
提交回复
热议问题