___
could anyone tell me why i get an error on the line: letters = input.Substring((count), 2)
it keeps saying the index is not with the substring but i don't see why that is
_____
Function TotalLetterCount(ByVal input As String)
'input string is processed character by character
'and keeps track of how many of each character is found
Dim count As Integer 'position in string
Dim length As Integer 'length of input string
Dim letters(25) As Integer 'array letters
Dim arrayElement As Integer 'arrayElement of unicode value
Dim letterCount As Integer 'integer to be used for
'total number of letters in the string
length = input.Length
count = 0
'processes character by character and keeps track of
'how many of each letter are found and updates the
'letters array
For count = 0 To (length - 1)
If (unicodeFor(input.Substring((count), 1)) >= 65) And _
(unicodeFor(input.Substring((count), 1)) <= 90) Then
arrayElement = ((unicodeFor(input.Substring((count), 1))) - 65)
letters(arrayElement) = 1 + letters(arrayElement)
End If
Next count
'adds items to letters listbox for all letters found
'and updates lettercount variable
For count = 0 To 25
If (letters(count) >= 1) Then
lstLetters.Items.Add((ChrW(count + 65)) & ": " & _
letters(count))
letterCount += letters(count)
End If
Next count
'places letterCount integer into TotalLetterCount
'textbox
lblTotalLetterCount.Text = letterCount
End Function
Function DigramCount(ByVal input As String)
Dim count As Integer 'count is position in string
Dim length As Integer 'length of input string
Dim nextLetter As Integer
Dim letter1 As Char
Dim letter2 As Char
Dim digram(58, 58) As Integer
Dim row As Integer
Dim column As Integer
Dim rowIndex As Integer
Dim columnIndex As Integer
Dim letters As String
'adds spaces to end and beginning of input string
input = " " & input & " "
length = input.Length
count = 0
For count = 0 To (length - 1)
letters = input.Substring((count), 2)
letter1 = CChar(letters.Substring(0, 1))
letter2 = CChar(letters.Substring(1, 1))
arrangeLetters(letter1, letter2)
row = ((AscW(letter1)) - 32)
column = ((AscW(letter2)) - 32)
If ((row >= 0) And (row <= 58)) Then
If ((column >= 0) And (column <= 58)) Then
digram(row, column) = 1 + digram(row, column)
End If
End If
Next count
For row = 0 To 58
For column = 0 To 58
If digram(row, column) >= (1) Then
lstDigrams.Items.Add((ChrW(row + 32)) & _
(ChrW(column + 32)) & ": " & digram(rowIndex, columnIndex))
End If
Next column
Next row
End Function