24-02-2009, 10:35 PM
well, obviously i've been away from MS/VB6 for a while, and i wanted to make a quick simple encryption program in VB, which just advanced the ASCII characters by a certain amount. However i have gotten an error.
i get a run-time error 5: invalid procedure call or argument, and highlights this line
thanks,
-Pb
Code:
Private Sub cmdEncrypt_Click()
Message = txtInput.Text
Dim EncryptedMsg As String
Dim checknum As Long
checknum = Rand(1, 9)
For i = 0 To 255
EncryptedMsg = Replace$(Message, Chr(i), Chr(i + checknum))
Next i
txtOutput.Text = EncryptedMsg
End Sub
Function Rand(ByVal Low As Integer, ByVal High As Integer) As Integer
Randomize
Rand = ((High - Low + 1) * Rnd) + Low
End Function
i get a run-time error 5: invalid procedure call or argument, and highlights this line
Code:
EncryptedMsg = Replace$(Message, Chr(i), Chr(i + checknum))
thanks,
-Pb