0

Hi guys im creating this cryptography program. And was wondering how to connect three conditions together.
*Forgot to mention it is in c# language*
I got a place where i can input a key and confirm the key, Those are already linked together when u click the encrypt button it will verify that both text areas are equivalent.
A combobox to choose the type of encryption &
The Encrypt buton to give the order to encrypt

I dont know how to go about and connect everything together. Can someone help me please?

I do have the code for the encryption and the types of encryption and implementation techniques. All i have to do is connect those 3 things together. I could have very well chose for for every one to open in a new form but i dont like the idea.

Anyways, Thanks in advance!
And if you want more info on the code just ask me and ill write back to ya!

2
Contributors
2
Replies
3
Views
12 Years
Discussion Span
Last Post by crypter
0

There are several ways to do that, I would go about it this way:

// the encrypt button event handler
encrypt_Click(object sender, EventArgs e)
{
    // assuming you've named the text box for the key txtKey and the
    // combo box for the encryption type cboEnc do the following
    string key = txtKey.Text;
    string encType = cboEnc.SelectedItem.ToString();
    switch(encType)
    {
          case "FirstEncryptionType":
               // use this encryption;
               break;
          case "SecondEncryptionType":
               // use this encryption
               break;
          default:
               // use the final incryption type
               break;
       }
}

So maybe I'm not understandin your question properly. But that's how you could do, just use a switch statment to find out which encryption type to use, then do the statements from there.

0

WoW thats great!
Now i was able to add this part of the code in but how would i go about after chosing the encryption type and actually clicking the ENCRYPT button to actually encrypt the file opened... I do have the algorithm.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.