在窗体上放入一个label控件,一个TEXT控件,一个PICTURE控件,如果在TEXT控件中输入数字,则弹出提示信息: 15
2个回答
展开全部
Dim K(65 To 90) As Integer
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii >= 48 And KeyAscii <= 57 Then
KeyAscii = 0
MsgBox "非法字符!", vbExclamation, "提示"
Exit Sub
End If
End Sub
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
Dim X As Integer
For I = 1 To Len(Text1.Text)
X = Asc(Mid(Text1.Text, I, 1))
If X >= 65 And X <= 90 Then
K(X) = K(X) + 1
End If
If X >= 97 And X <= 122 Then
K(X - 32) = K(X - 32) + 1
End If
Next I
Picture1.Cls
For J = 65 To 90
Picture1.Print Chr(J) & "字母的个数是" & K(J) & "个!"
K(J) = 0
Next J
End Sub
PS:有个人跟你提了一样的问题
Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii >= 48 And KeyAscii <= 57 Then
KeyAscii = 0
MsgBox "非法字符!", vbExclamation, "提示"
Exit Sub
End If
End Sub
Private Sub Text1_KeyUp(KeyCode As Integer, Shift As Integer)
Dim X As Integer
For I = 1 To Len(Text1.Text)
X = Asc(Mid(Text1.Text, I, 1))
If X >= 65 And X <= 90 Then
K(X) = K(X) + 1
End If
If X >= 97 And X <= 122 Then
K(X - 32) = K(X - 32) + 1
End If
Next I
Picture1.Cls
For J = 65 To 90
Picture1.Print Chr(J) & "字母的个数是" & K(J) & "个!"
K(J) = 0
Next J
End Sub
PS:有个人跟你提了一样的问题
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询