rivate Sub Form_KeyPress(KeyAscii As Integer) Call Text1_KeyPress(KeyAscii) End Sub Private Sub Form_Load() Me.KeyPreview = True End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer) If (KeyAscii = 65) Then KeyAscii = Asc("?") End If Text1.Text = Text1.Text & Chr(KeyAscii) End Sub 一个例子!屏蔽了大写的A 换成 "?"
Private Sub Form_KeyPress(KeyAscii As Integer) Call Text1_KeyPress(KeyAscii) End Sub Private Sub Form_Load() Me.KeyPreview = True End SubPrivate Sub Text1_GotFocus() Me.Text1.Tag = "1" End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer) If Me.Text1.Tag = "0" Then If (KeyAscii = 65) Then KeyAscii = Asc("?") End If Text1.Text = Text1.Text & Chr(KeyAscii) End If End SubPrivate Sub Text1_LostFocus() Me.Text1.Tag = "0" End Sub 改进版本!更能表达你的意思!你试试 合适就揭贴吧
Call Text1_KeyPress(KeyAscii)
End Sub
Private Sub Form_Load()
Me.KeyPreview = True
End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)
If (KeyAscii = 65) Then
KeyAscii = Asc("?")
End If
Text1.Text = Text1.Text & Chr(KeyAscii)
End Sub
一个例子!屏蔽了大写的A 换成 "?"
Call Text1_KeyPress(KeyAscii)
End Sub
Private Sub Form_Load()
Me.KeyPreview = True
End SubPrivate Sub Text1_GotFocus()
Me.Text1.Tag = "1"
End SubPrivate Sub Text1_KeyPress(KeyAscii As Integer)
If Me.Text1.Tag = "0" Then
If (KeyAscii = 65) Then
KeyAscii = Asc("?")
End If
Text1.Text = Text1.Text & Chr(KeyAscii)
End If
End SubPrivate Sub Text1_LostFocus()
Me.Text1.Tag = "0"
End Sub
改进版本!更能表达你的意思!你试试
合适就揭贴吧