'大写转小写
Private Sub Text1_KeyPress(KeyAscii As Integer)
    If KeyAscii >= 65 And KeyAscii <= 90 Then
        KeyAscii = KeyAscii + 32
    End If
End Sub'小写转大写
Private Sub Text2_KeyPress(KeyAscii As Integer)
    If KeyAscii >= 97 And KeyAscii <= 122 Then
 KeyAscii = KeyAscii - 32
    End If
End Sub

解决方案 »

  1.   

    private void textBox1_TextChanged(object sender, System.EventArgs e)
    {
    this.textBox1.Text=this.textBox1.Text.ToUpper();
    }
      

  2.   

    private void textBox1_TextChanged(object sender, System.EventArgs e)
    {

    this.textBox1.Text=this.textBox1.Text.ToUpper();
    this.textBox1.SelectionStart=this.textBox1.Text.Length;
    this.textBox1.SelectionLength=0; }
      

  3.   

    这不很简单吗?把TextBox的CharacterCasing属性改为Upper,即文本框中输入的所有文本都转换为大写。不用写什么代码就可以实现的。
      

  4.   

    如果改为Lower,输入的内容就自动转为小写了。
    默认是Normal,即不对输入的文本进行任何转换。
      

  5.   

    private void TextBox1_KeyPress(object sender, System.EventArgs e)
    {
    this.textBox1.Text+=e.KeyChar.ToUpper();
    }
      

  6.   

    private void TextBox1_KeyPress(object sender,System.Windows.Forms.KeyPressEventArgs e)
    {
    this.textBox1.Text+=e.KeyChar.ToUpper();
    }
      

  7.   

    pinglv(Amanda)说的方法最标准,不需要写任何代码就可以实现所需的功能,非常好。
      

  8.   

    用TextChanged或设置CharacterCasing属性都行。