Public Class Form1
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim c1(100) As Char
Dim c2(100) As Integer
Dim counter As Integer = 1
Dim i As Integer
For i = 1 To 100
c1(i) = ""
c2(i) = 1
Next
TextBox2.Text = ""
If TextBox1.Text.Length > 0 Then
For i = 0 To TextBox1.Text.Length - 1
If Not c1.Contains(TextBox1.Text.Substring(i, 1)) Then
c1(counter) = TextBox1.Text.Substring(i, 1)
counter += 1
Else
c2(c1.ToList.IndexOf(TextBox1.Text.Substring(i, 1))) += 1
End If
Next
For i = 1 To counter - 1
TextBox2.Text = String.Format("{0}{1} : {2}{3}", TextBox2.Text, c1(i), c2(i), vbCrLf)
Next
End If
End Sub
Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPress
If Not Char.IsDigit(e.KeyChar) And Not Char.IsControl(e.KeyChar) Then
e.Handled = True
End If
End Sub
End Class