private void btn_encrypt_Click(object sender, EventArgs e) { Output.Output output = new Output.Output(); Encrypt.Encrypt encrypt = new Encrypt.Encrypt(); Encrypt.EncryptedPackage package = new Encrypt.EncryptedPackage(); if (File_Upload.Checked) // if its a file upload it will pass the file name otherwise the file name is null { try { package = encrypt.EncyptText(response); output.Textorfile(package.text, package.key, "file", filename); File.Delete(OriginalFileName); response = null; MessageBox.Show("Your text has been encrypted successfuly and the uploaded file has been deleted", "Complete", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch { MessageBox.Show("Your text has not been encrypted because an error has occured", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { try { response = Input_textbox.Text; response = response.Replace("\r\n", null); package = encrypt.EncyptText(response); output.Textorfile(package.text, package.key, "textbox", null); } catch { MessageBox.Show("Your text has not been encrypted because an error has occured", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }