declare sub enc_dec

CREATE Form AS QFORM
    Caption = "Form1"
    Width = 335
    Height = 243
    Center
    CREATE Button1 AS QBUTTON
        Caption = "Encode / Decode"
        Left = 82
        Top = 170
        Width = 147
        onclick = enc_dec
    END CREATE
    CREATE RichEdit1 AS QRICHEDIT
        Left = 19
        Top = 12
        Width = 265
        Height = 137
        TabOrder = 1
        plaintext = 1      'very important
    END CREATE
END CREATE

Form.ShowModal



sub enc_dec
dim x as integer
dim newstring as string
Richedit1.loadfromfile "textfile.txt"
newstring = Richedit1.text
for x = 1 to len(newstring)
newstring = replace$(newstring, (chr$(256 - asc(mid$(newstring, x, 1)))), x)
next x
Richedit1.text = newstring
Richedit1.savetofile "textfile.txt"
end sub

