各位:
  
    大家都知道,键盘输入字母时,小写的字母的 ascii 是在 97-122 之间,如何使输入的小写字母自动转换为大写 65-90.就是说,我的textbox 只接受 大写字母,而且在小写状态下输入时自动转换为大写.    比如我只要转换以下五 个字母即可:
    e、s 、w、n、c 
    为各自对应的大写!

解决方案 »

  1.   

    chr(asc("e") or 32)
    e的大写
      

  2.   

    Private Sub Text1_Change()
    Text1.Text = UCase(Text1.Text)
    End Sub
      

  3.   

    Private Sub Text1_Change()
        Text1.Text = UCase(Text1.Text)
        Text1.SelStart = Len(Text1.Text)
    End Sub
      

  4.   

    最佳方案:
    Private Sub Text1_KeyPress(KeyAscii As Integer)
        
        If KeyAscii >= 97 And KeyAscii <= 122 Then
            KeyAscii = KeyAscii - 32
        End If
        
    End Sub
      

  5.   

    Private Sub Text1_KeyPress(KeyAscii As Integer)
        If KeyAscii >= 97 And KeyAscii <= 122 Then
            KeyAscii = KeyAscii - 32
        End If
    End Sub好方法,支持!