M
MuZZy
HI,
I have a user control, say with one textBox.
I need the following: when the user closes form (either calling Form.Close, or pressing "X" or anyhow),
UserControl copies a file from a predefined folder to a folder in the textBox.
UserControl doesn't have a "Closing" event, so i tried to override UserControl.Dispose() :
// ==========================================================
protected override void Dispose( bool disposing )
{
// Here what i've added
File.Copy(SourceFile, TextFolder.Text + DestFile);
// If you check TextFolder.Text value, it's = "" for some reason...
// From here VS generated
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
// ==========================================================
The problem is that when i get to Dispose function, TextFolder.Text value is somehow blank.
I don't really understand why, as the UserControl is not disposed yet, but all controls located on the usercotrol,
lose values when get into Dispose.
Any ideas would be very, very, very appreciated!
Thank you,
Andrey
I have a user control, say with one textBox.
I need the following: when the user closes form (either calling Form.Close, or pressing "X" or anyhow),
UserControl copies a file from a predefined folder to a folder in the textBox.
UserControl doesn't have a "Closing" event, so i tried to override UserControl.Dispose() :
// ==========================================================
protected override void Dispose( bool disposing )
{
// Here what i've added
File.Copy(SourceFile, TextFolder.Text + DestFile);
// If you check TextFolder.Text value, it's = "" for some reason...
// From here VS generated
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
// ==========================================================
The problem is that when i get to Dispose function, TextFolder.Text value is somehow blank.
I don't really understand why, as the UserControl is not disposed yet, but all controls located on the usercotrol,
lose values when get into Dispose.
Any ideas would be very, very, very appreciated!
Thank you,
Andrey