I'm guessing you were getting an access violation error, which usually means you are trying to access properties of an object that has not yet been created. Has form2 been created already but has been hidden or visible:=false?
For encryptions, depends on how secure you need it to be. Some easy things you can do is:
1. Add an offset to each character, like "M" is an ASCII 77, so replace it with ASCII 127, for example. Similarly, you could do all sort of character-by-character operations, like vary the offset according to the position in the string, or make other bit-level changes.
2. Jumble the letters
3. Mix the string in with another long and randomly generated string.
4. Use a public-key type routine. The math is easy, but to be effective you have to use some big numbers.