I need help with an assignment please. I have 2 forms: form1 has a string( I get it after some encryption/decryption), Form2(frmSaveFile) has the saveFileDialog where the user will browse a location to save the generated string into a file.
my question is: how do I pass the string from form1 to savefileDialog in form2? and eventually read it back to form1 for decryption?
Here is how my Form2 code looks like:
private Form1 myForm1;
private void btnBrowse_Click_1(object sender, EventArgs e)
{
myForm1 = new Form1();
string val = myForm1.Encrypted_TextVal; // I try to get this val from form1 but it's null cause I call it before form1 does anything with it!
SaveFileDialog save = new SaveFileDialog();
if (save.ShowDialog() == System.Windows.Forms.DialogResult.OK) {
StreamWriter write = new StreamWriter(File.Create(save.FileName));
write.Write(val);
}
Here is Form2 code:
{
....code code.....
string hashDecryptedText = BitConverter.ToString(sh1.ComputeHash(textToBitArray.GetBytes(Decrypted))); // string to save in a file
}
Thank you for any help