954,180 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Caesar cipher problem with CHR(32)

Hi all

Ive been trying ever combination to get this code finished. Basically I can get the cipher to work okay. But the space character returns as U, Im trying to figure out how.

Do I need another loop? Or am I on the wrong track and should scrape this approach?

Thanks, Lawdie

Private Sub cmdRandy_Click()
Dim count As Integer, free As Integer
Dim original As String, phoenix As String, build As String

original = txtMatrix.Text
count = Len(txtMatrix.Text)
For free = 1 To count
phoenix = Asc(Mid(original, free, 1))
If phoenix = Chr(32) Then
phoenix = phoenix + Chr(32)

Else: phoenix = phoenix + Asc(5)

phoenix = Chr(phoenix)

End If

build = build + phoenix

Next free
MsgBox build, vbInformation, "Result"
txtMatrix.Text = ""
txtMatrix.SetFocus

End Sub

lawdie
Newbie Poster
1 post since Jan 2004
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You