私はリッチテキストボックスを持っていて、単語を配列に変換しました。次に、長さと出力を受け取るコードがあります...唯一の問題は、配列のすべての異なる値をループしてチェックする方法がわからないことです。配列の個々の部分の長さ。
(私はこれをTextChangedに設定しています)
Dim len1, len2, len3, len4, len5, len6, len7, len8, len9, len10, len11, len12, len13, len14, len15 As Integer
Dim input As String
Dim words As String()
Dim length As Integer
input = RichTextBox1.Text
words = input.Split(New String() {" "}, StringSplitOptions.RemoveEmptyEntries)
For Each w In words
length = Len(w)
Select Case length
Case 1
len1 = len1 + 1
Case 2
len2 = len2 + 1
Case 3
len3 = len3 + 1
Case 4
len4 = len4 + 1
Case 5
len5 = len5 + 1
Case 6
len6 = len6 + 1
Case 7
len7 = len7 + 1
Case 8
len8 = len8 + 1
Case 9
len9 = len9 + 1
Case 10
len10 = len10 + 1
Case 11
len11 = len11 + 1
Case 12
len12 = len12 + 1
Case 13
len13 = len13 + 1
Case 14
len14 = len14 + 1
Case 15
len15 = len15 + 1
End Select
Next
letcount.onelet.Text = Val(len1)
letcount.twolet.Text = Val(len2)
letcount.threelet.Text = Val(len3)
letcount.fourlet.Text = Val(len4)
letcount.fivelet.Text = Val(len5)
letcount.sixlet.Text = Val(len6)
letcount.sevenlet.Text = Val(len7)
letcount.eightlet.Text = Val(len8)
letcount.ninelet.Text = Val(len9)
letcount.tenlet.Text = Val(len10)
letcount.elevenlet.Text = Val(len11)
letcount.twelevelet.Text = Val(len12)
letcount.thirteenlet.Text = Val(len13)
letcount.fourteenlet.Text = Val(len14)
letcount.fifteenlet.Text = Val(len15)