Call CheckLetter(char, letter)
What I am trying to do above is send the string char to the procedure CheckLetter, and from CheckLetter I am trying to retrieve letter. How do I do this?
All the code from my project.
Dim Alphabet(0 To 25) As String
Dim codeword, wordtoencrypt As String
Dim Shift(0 To 30) As Integer
Private Sub cmdEncrypt_Click()
codeword = LCase(txtCodeword.Text)
wordtoencrypt = LCase(txtData.Text)
Call CalcShift(codeword, Shift())
lblOutput.Caption = Shift(0)
End Sub
Private Sub Form_Load()
FillAlphabet
End Sub
Public Sub FillAlphabet()
Alphabet(0) = "a"
Alphabet(1) = "b"
Alphabet(2) = "c"
Alphabet(3) = "d"
Alphabet(4) = "e"
Alphabet(5) = "f"
Alphabet(6) = "g"
Alphabet(7) = "h"
Alphabet(8) = "i"
Alphabet(9) = "j"
Alphabet(10) = "k"
Alphabet(11) = "l"
Alphabet(12) = "m"
Alphabet(13) = "n"
Alphabet(14) = "o"
Alphabet(15) = "p"
Alphabet(16) = "q"
Alphabet(17) = "r"
Alphabet(18) = "s"
Alphabet(19) = "t"
Alphabet(20) = "u"
Alphabet(21) = "v"
Alphabet(22) = "w"
Alphabet(23) = "x"
Alphabet(24) = "y"
Alphabet(25) = "z"
End Sub
Sub CalcShift(ByVal codeword As String, ByRef ArrayShift() As Integer)
Dim char As String
Dim loopcount, index As Integer
Dim flag, letter As Boolean
For loopcount = 1 To Len(codeword)
index = 0
char = Mid(codeword, loopcount, 1)
Call CheckLetter(char, letter)
If letter = True Then
flag = False
While flag = False And index < 26
If Mid(codeword, loopcount, 1) = Alphabet(index) Then
ArrayShift(loopcount) = Alphabet(index)
flag = True
End If
index = index + 1
Wend
Else
End If
Next loopcount
End Sub
Sub CheckLetter(ByVal character As String, ByVal isletter As Boolean)
Dim asciichar As Integer
asciichar = Asc(character)
If asciichar >= 97 And asciichar <= 122 Then
isletter = True
Else
isletter = False
End If
End Sub