sachi vasishta

sachi vasishta

  • NA
  • 252
  • 0

form hiding/closing event problem

Aug 3 2009 4:43 AM

Hi
In a form called FileHandling.cs ,which is called from the main() function, I will
 call another form called LicenceKey. My questionn is after calling the Licencekey form I want to close/hide the Filehandling.cs . I have written the following code to do that but its not working. plz help
private
void FileHandling_Load(object sender, EventArgs e)
{
string path = @"c:\licence.txt";
if (File.Exists(path))
{
FileHandling.ActiveForm.Close();
Form1 login = new Form1();
this.Hide();
}
else
{
FileStream fs = File.Create(path, 1024);
byte[] info = new UTF8Encoding(true).GetBytes("hi,written");
fs.Write(info, 0, info.Length);
fs.Close();

this.Hide();
LicenceKey lkey = new LicenceKey();
lkey.Show();
}

}
Note: FileHandling.cs is the Parent form
Thanks
Sachi

 

Answers (4)