Check if Keys is Letter/Digit/Special Symbol

后端 未结 6 2045
时光取名叫无心
时光取名叫无心 2021-01-02 18:45

I override ProcessCmdKey and when I get Keys argument, I want to check if this Keys is Letter or Digit or Special Symbol.

I ha

6条回答
  •  失恋的感觉
    2021-01-02 18:49

    Try using keyData.KeyCode and maybe even testing within a range instead of using the Char.IsLetterOrDigit. e.g.

    if (keyData.KeyCode >= Keys.D0 && keyData.KeyCode <= Keys.Z) {
      ...
    }
    

提交回复
热议问题