Hi all! I am creating a program to encrypt files in Rijndael 64 bit encryption. I am having a problem with one of the aspects i want to include in my code. It sounds very basic maybe but i have tried many things and somehow i can't seem to figure out why i can't solve the problem.
Ok you might be wondering what the problem is! well its simple read the code elow and then, i will explain my dilema, or even better if you are good enough you'll find out on your own.
private void button3_Click(object sender, System.EventArgs e)
{
if (textBox2.Text != textBox3.Text || textBox3.Text == "")
{
MessageBox.Show("The passwords you chose do not match or text boxs are empty! Type the new password again", "Error");
Thread.CurrentThread.Start();
}
LabelChange();
string encType = comboBox1.SelectedItem.ToString();
switch(encType)
{
case "Rijndael 64 bits":
password = textBox3.Text;
EncryptFile1();
break;
default:
Close();
break;
}
}
Alright, now guys, the problem is that, i have 2 text boxes, one text box to enter key and the other to confirm the key chosen.
I have code there will verify both keys in both text boxes and give out a message box that tell you if they are not the same.
All that is great! But when it comes to encrypt and both keys don't match, it gives out the warning message but keeps on encrypting using the confirm key text box through this code:
password = textBox3.Text;
I had no choice on choosing one box as the password, or else the program itself woudln't work!
Now to prevent the encryption when you enter to keys that do not match, i put this code that just creates an error.
Thread.CurrentThread.Start();
Would there be a way to overcome this code and actually make the program STOP encrypting if the keys are not equivalent. It would be great if someone can solve this problem of mine. And if you can there is another problem. If you uys got time and want to take a shot at it, its up to you.
I decided not to include a progress bar thinking it would take too much time and code to be able to make that thing work so i decided the do soething a bit more primitive if you like. I decided to make a label that will change text when you go through the steps of encryption. I also wanted to change the text of the label to write "processing..." Will encrypting, that thing the program kinda stops responding while encrypting and does not display the change in label. I was wondering if there was a way of overcoming that situation with some code.
Well thats it folks, i hope you guys can help with my dilemas! Anyways take care! and hope to hear from you guys soon! Thanks in advance
Crypter