Note that there are some explanatory texts on larger screens.

plurals
  1. POEncrypter with Key and Message - VB.Net
    text
    copied!<p>Okay, so I am trying to make my program take whatever your key is, and loop through each character of the key, then find the ascii code for each character code, and then loop through each character of the message, finding the ascii code of each of them, and adding the key code to the message code, doing this for each character in the key, to each character in the message. I ran into a little problem, it changes the message right after the first letter is added, and I can't figure out how to fix it, any help would be great!</p> <p>Basically, all I want is to that the ascii code for the key characters and add them to the ascii code for the message characters, then convert that final code back to the new characters in the message text. Using this:</p> <pre><code>tbxMessage.Text = (AscW(Mid(tbxMessage.Text, xForMess, 1)) + AscW(vTemp)) </code></pre> <p>Here is everything I've got so far:</p> <pre><code>Public Class Form1 Function fctEncryptDecrypt(pMess As String, pKey As String) As String If Len(tbxMessage.Text) &gt; 0 Then Dim xForKey As Integer Dim xForMess As Integer Dim intKey As Integer Dim intMessage As Integer Dim strAsciiKeyChar As String Dim intAsciiKeyChar As Integer Dim strAsciiMesChar As String Dim intAsciiMesChar As Integer Dim vTemp As String Dim vTempMess As String intKey = Len(tbxKey.Text) intMessage = Len(tbxMessage.Text) For xForKey = 1 To intKey strAsciiKeyChar = Mid(tbxKey.Text, xForKey, 1) intAsciiKeyChar = AscW(strAsciiKeyChar) vTemp = intAsciiKeyChar For xForMess = 1 To intMessage strAsciiMesChar = Mid(tbxMessage.Text, xForMess, 1) intAsciiMesChar = AscW(strAsciiMesChar) vTempMess = vTemp + intAsciiMesChar tbxMessage.Text = (AscW(Mid(tbxMessage.Text, xForMess, 1)) + AscW(vTemp)) Next xForMess Next xForKey Label1.Text = vTemp Else MessageBox.Show("No Message Found") End If End Function Private Sub btnEncrypt_Click(sender As System.Object, e As System.EventArgs) Handles btnEncrypt.Click fctEncryptDecrypt(tbxMessage.Text, tbxKey.Text) End Sub End Class </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload