ASCII Shift

                            
        Dim Encrypt As String = ""
        Dim letter As Char
        Dim i, charsInFile As Short
        SaveFileDialog1.Filter = "Text file |*.txt"
        If SaveFileDialog1.ShowDialog() = DialogResult.OK Then
            Try ' save text with encryption scheme (ASCII code + 1)
                charsInFile = TextBox1.Text.Length
                For i = 0 To charsInFile - 1
                    letter = TextBox1.Text.Substring(i, 1)
                    ' determine the ASCII code and add one to it
                    Encrypt = Encrypt & Chr(Asc(letter) + 1)
                Next
                 ' write encrypted text to file
                 My.Computer.FileSystem.WriteAllText(SaveFileDialog1.FileName, Encrypt, False) 
                 TextBox1.Text = Encrypt TextBox1.Select(0, 0)
                 ' remove text selection
            Catch ex As Exception
                MsgBox(ex.Message, MsgBoxStyle.Information, "Error")
            End Try
        End If
                            
                                

                            
        Dim AllText As String
        Dim i, charsInFile As Short
        Dim letter As Char
        Dim Decrypt As String = ""
        OpenFileDialog1.Filter = "Text file |*.txt"
        If OpenFileDialog1.ShowDialog() = Windows.Forms.DialogResult.OK Then
            If My.Computer.FileSystem.FileExists(OpenFileDialog1.FileName) Then
                Try
                    AllText = My.Computer.FileSystem.ReadAllText(OpenFileDialog1.FileName)
                    ' now decrypt string by subtracting 1
                    charsInFile = AllText.Length ' get length of string
                    For i = 0 To charsInFile - 1 ' loop once for each char
                        letter = AllText.Substring(i, 1) ' get char
                        Decrypt = Decrypt & Chr(Asc(letter) - 1)
                    Next i ' and build new string
                    TextBox1.Text = Decrypt ' then display converted string
                    TextBox1.Select(0, 0) ' remove text selection
                Catch ex As Exception
                    MsgBox(ex.Message, MsgBoxStyle.Information)
                End Try
            End If
        End If