G
Guest
What function is called in response to a click on "Close" on system menu (the
"X" in the top right side of window)?
"X" in the top right side of window)?
Amalorpavanathan Yagulasamy(AMAL)MCP said:The following events will be called,
Deactivate
Closing
Closed
private void Form1_Closed(object sender, System.EventArgs e)
{
}
private void Form1_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
}
private void Form1_Deactivate(object sender, System.EventArgs e)
{
}
--
Regards,
Amal [MCP, MCS]
http://geocities.com/techsharing
Scotty said:What function is called in response to a click on "Close" on system menu (the
"X" in the top right side of window)?
Scotty said:I tried this but the events weren't call. If I click on the Close nothing
happens. What am I doing wrong?
// private void Form1_Closed(object sender, System.EventArgs e)
// private void Form1_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
private void Form1_Deactivate(object sender, System.EventArgs e)
{
DialogResult result;
if (chng == true)
{
result = MessageBox.Show("Do you want to save your file?",
"Save?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
if (result == DialogResult.Cancel)
return;
if (result == DialogResult.Yes)
{
if (Filename == null)
{
saveAsToolStripMenuItem_Click(sender, e);
}
if (Filename != null)
{
Cover(); // get text into richTextBox7
using (StreamWriter sr = new
StreamWriter(Filename))
{
sr.Write(richTextBox7.Text);
}
}
}
}
}
Amalorpavanathan Yagulasamy(AMAL)MCP said:The following events will be called,
Deactivate
Closing
Closed
private void Form1_Closed(object sender, System.EventArgs e)
{
}
private void Form1_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
}
private void Form1_Deactivate(object sender, System.EventArgs e)
{
}
--
Regards,
Amal [MCP, MCS]
http://geocities.com/techsharing
Scotty said:What function is called in response to a click on "Close" on system
menu (the
"X" in the top right side of window)?
Jonathan Allen said:Check to see if the events were actually wired to the functions.
--
Jonathan Allen
Scotty said:I tried this but the events weren't call. If I click on the Close nothing
happens. What am I doing wrong?
// private void Form1_Closed(object sender, System.EventArgs e)
// private void Form1_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
private void Form1_Deactivate(object sender, System.EventArgs e)
{
DialogResult result;
if (chng == true)
{
result = MessageBox.Show("Do you want to save your file?",
"Save?", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Exclamation);
if (result == DialogResult.Cancel)
return;
if (result == DialogResult.Yes)
{
if (Filename == null)
{
saveAsToolStripMenuItem_Click(sender, e);
}
if (Filename != null)
{
Cover(); // get text into richTextBox7
using (StreamWriter sr = new
StreamWriter(Filename))
{
sr.Write(richTextBox7.Text);
}
}
}
}
}
Amalorpavanathan Yagulasamy(AMAL)MCP said:The following events will be called,
Deactivate
Closing
Closed
private void Form1_Closed(object sender, System.EventArgs e)
{
}
private void Form1_Closing(object sender,
System.ComponentModel.CancelEventArgs e)
{
}
private void Form1_Deactivate(object sender, System.EventArgs e)
{
}
--
Regards,
Amal [MCP, MCS]
http://geocities.com/techsharing
:
What function is called in response to a click on "Close" on system
menu (the
"X" in the top right side of window)?