Thanks for your help so far. Just 1 more question. Ive managed to succesfully encrypt the data that is inputted into textbox1, but decoding it fails.
public Form1()
{
InitializeComponent();
Decode();
}
private void button2_Click(object sender, EventArgs e)
{
Decode();
StreamReader rb = new StreamReader("C:\\\\file.txt");
MessageBox.Show(rb.ReadToEnd());
rb.Close();
}
public string Decode()
{
FileStream fs = new FileStream(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + "\\\\file.txt", FileMode.Open, FileAccess.ReadWrite);
byte\[\] array = new byte\[400\];
GZipStream gstream = new GZipStream(fs, CompressionMode.Decompress);
gstream.Read(array, 0, array.Length);
gstream.Close();
string Mytext = Encoding.UTF8.GetString(array);
return Mytext;
}
It doesnt return any errors, it just clears the file. Any help would be appreciated