Picture1.Print Chr(j + 64) & "=" & "a(j)";中a(j)是不要加“”的,否則就變成了字串了,還有在picturebox裡列印時最好換行,不要列印在一行上,太長了,所以,建議你把後面冒號也去掉,如下:
Private Sub Command1_Click()
Dim c As String, x%, a(1 To 26) As Integer
For i = 1 To Len(Text1.Text)
c = UCase(Mid(Text1.Text, i, 1))
If c >= "A" And c <= "Z" Then
j = Asc(c) - 64
a(j) = a(j) + 1
End If
Next i
For j = 1 To 26
Picture1.Print Chr(j + 64) & "=" & a(j)
Next j
End Sub
Picture1.Print Chr(j + 64) & "=" & "a(j)";中a(j)是不要加“”的,否則就變成了字串了,還有在picturebox裡列印時最好換行,不要列印在一行上,太長了,所以,建議你把後面冒號也去掉,如下:
Private Sub Command1_Click()
Dim c As String, x%, a(1 To 26) As Integer
For i = 1 To Len(Text1.Text)
c = UCase(Mid(Text1.Text, i, 1))
If c >= "A" And c <= "Z" Then
j = Asc(c) - 64
a(j) = a(j) + 1
End If
Next i
For j = 1 To 26
Picture1.Print Chr(j + 64) & "=" & a(j)
Next j
End Sub