private void buttonProceedeForCompression_Click(object sender, EventArgs e) { try { string orignalStirng = richTextBoxEncrypte.Text; string forByteCode; StringBuilder for8Cont = new StringBuilder(); string ChakingSt = "0000000";//this is used for practice to replace seven zeros "0000000" Compression cmpr = new Compression(); forByteCode = (for8Cont.Append((cmpr.Coding(orignalStirng) + ChakingSt))).ToString(); byte[] newForByte = cmpr.GetBytes(forByteCode); string encodedSt = Encoding.Default.GetString(newForByte); richTextBoxEncrypte.Text = encodedSt; richTextBoxDecryption.Text = encodedSt; buttonEncrypte.Enabled = false; buttonProceedeForCompression.Enabled = false; buttonDecrypte.Enabled = false; buttonDecompress.Enabled = true; MessageBox.Show("System has Compressed the Encrypted text\n\nPress OK to proceede "); } catch (Exception ex) { MessageBox.Show("System Can not Compress your Message \n\nException:\n" + ex.Message + "\n\nPress OK to Proceede"); } }