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

Use ByRef to get something from the sub:

Sub CheckLetter(ByVal character As String, ByRef isletter As Boolean)

or change sub to function:

Function CheckLetter(ByVal character As String) As Boolean
    
    Dim asciichar As Integer
    asciichar = Asc(character)
    
    If asciichar >= 97 And asciichar <= 122 Then
        CheckLetter = True
    Else
        CheckLetter = False
    End If
  
End Function

Thanks,

So simple i can't believe i didn't realise it. Thanks for your help.

You're welcome :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.