Detect when a child form is closed

I have he following Form: An Initialize Function that is called when the Form1 is created. A button that opens another Form (Form2) What I need is to call Initialize() not only when Form1 is created, but whenever Form2 is closed, since Form2 might have modified some stuff that makes Initialize need to be called… Read More Detect when a child form is closed

C# System.IO.DirectoryNotFoundException: Could not find a part of the path

try { string directory = @"D:/user/user.txt"; FileStream FS = new FileStream(directory, FileMode.Append); StreamWriter SW = new StreamWriter(FS); string register; register = $"{generateID()};{txtfirstName.Text};{txtLastName.Text};{txtUser.Text};{txtEmail.Text};{txtPersonalID.Text}"; SW.WriteLine(register); SW.Close(); FS.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } I run this code in c# windows forms .NET framework and constanly i get the same message. I am in university and i… Read More C# System.IO.DirectoryNotFoundException: Could not find a part of the path