在 C# 中 如何使用户在文本框中输入的 “A”~“Z” 变成 SPACE 键(或者是 空 键)目的是想把用户在某个文本框中输入的 “A”~“Z”屏蔽掉。 

解决方案 »

  1.   

    if(e.KeyChar == 'A' | e.KeyChar == 'Z')
                {
                    e.Handled = true;
                }
      

  2.   

    value = value.replace(/[A-Z]/g,"");
      

  3.   

    code=C#]            if (e.KeyChar >= (char)65 && e.KeyChar <= (char)90)
                {
                    e.Handled = true;
                }
    [/code]
      

  4.   


                if (e.KeyChar >= (char)65 && e.KeyChar <= (char)90)
                {
                    e.Handled = true;
                }
      

  5.   

    不管用啊 private void txt5_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
    { if (e.KeyValue  >= 65 && e.KeyValue <= 90)
    {
    e.Handled = true;
    }
      

  6.   

    OK 了
     在 KeyPress 中事件中可以