Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Dim a(25) As Integer
Dim c As Char, Le%, i%, j%, sumc%
If Asc(e.KeyChar) = 13 Then
Le = Len(TextBox1.Text)
For i = 1 To Le
c = UCase(Mid(TextBox1.Text, i, 1))
If c >= "A" And c <= "Z" Then
j = Asc(c) - Asc("A")
a(j) += 1
End If
Next
Label3.Text = ""
For i = 0 To 25
If a(i) > 0 Then
sumc = sumc + a(i)
Label3.Text &= Chr(i + 65) & "=" & a(i) & " "
End If
Next
Label3.Text &= vbCrLf & "共有" & sumc & "个字母"
End If
End Sub Private Sub TextBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress
Dim a(25) As Integer
Dim c As Char, Le%, i%, j%, sumc%
If Asc(e.KeyChar) = 13 Then
Le = Len(TextBox1.Text)
For i = 1 To Le
c = UCase(Mid(TextBox1.Text, i, 1))
If c >= "A" And c <= "Z" Then
j = Asc(c) - Asc("A")
a(j) += 1
End If
Next
Label3.Text = ""
For i = 0 To 25
If a(i) > 0 Then
sumc = sumc + a(i)
Label3.Text &= Chr(i + 65) & "=" & a(i) & " "
End If
Next
Label3.Text &= vbCrLf & "共有" & sumc & "个字母"
End If
End Sub