今天有一个系统要上线测试,以前也没有在意用户输入账号的大小写导致系统的数据看起来很不舒服,

好在今天时间比较充足,就花了会儿时间研究了一下,最后找到一个方法,很简单,不过难者不会,会者不难,

特地将代码贴出来,希望可以帮到大家。

private void txtAccount_KeyPress(object sender, KeyPressEventArgs e)
{
    //将用户输入的小写字母转成大写的形式
    e.KeyChar = char.ToUpper(e.KeyChar);
}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-11
  • 2021-09-08
猜你喜欢
  • 2022-12-23
  • 2021-09-01
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-13
相关资源
相似解决方案