public void btnEncryptFile_Click(object sender, EventArgs e) { if (txtFilePath.Text == "") { MessageBox.Show("Please Choose a File to Encrypt", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error); btnBrowse.Focus(); } else if (txtEnKey.Text == "") { MessageBox.Show("Enter Key for Encryption", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Error); txtEnKey.Focus(); } else { pgsEncryptionBar.Show(); Thread.Sleep(500); pgsEncryptionBar.Value = 20; Thread.Sleep(500); String inputString = rtbFileContent.Text; String key = txtEnKey.Text; VigenereCipher vc = new VigenereCipher(); EncryptedText = vc.EncryptText(inputString, key); pgsEncryptionBar.Value = 60; Thread.Sleep(500); pgsEncryptionBar.Value = pgsEncryptionBar.Maximum; lblDone.Show(); Thread.Sleep(1500); btnViewFile.Show(); btnClearAll.Show(); } }
private void btnEncryptText_Click(object sender, EventArgs e) { if (rtbInputText.Text == "") { MessageBox.Show("Please Enter Some Text String", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else if (txtKey.Text == "") { MessageBox.Show("Please Enter Encryption Key", "Alert", MessageBoxButtons.OK, MessageBoxIcon.Stop); } else { String inputString = rtbInputText.Text; String key = txtKey.Text; VigenereCipher vc = new VigenereCipher(); String EncryptedText = vc.EncryptText(inputString, key); rtbEncryptedText.Text = EncryptedText; } }