473,769 Members | 4,202 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Close on system menu (the "X" in the top right side of window)

What function is called in response to a click on "Close" on system menu (the
"X" in the top right side of window)?
Nov 17 '05 #1
6 1570
The following events will be called,
Deactivate
Closing
Closed

private void Form1_Closed(ob ject sender, System.EventArg s e)
{
}

private void Form1_Closing(o bject sender,
System.Componen tModel.CancelEv entArgs e)
{
}

private void Form1_Deactivat e(object sender, System.EventArg s e)
{
}

--
Regards,
Amal [MCP, MCS]
http://geocities.com/techsharing
"Scotty" wrote:
What function is called in response to a click on "Close" on system menu (the
"X" in the top right side of window)?

Nov 17 '05 #2
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(ob ject sender, System.EventArg s e)
// private void Form1_Closing(o bject sender,
System.Componen tModel.CancelEv entArgs e)
private void Form1_Deactivat e(object sender, System.EventArg s e)
{
DialogResult result;
if (chng == true)
{
result = MessageBox.Show ("Do you want to save your file?",
"Save?", MessageBoxButto ns.YesNoCancel, MessageBoxIcon. Exclamation);
if (result == DialogResult.Ca ncel)
return;
if (result == DialogResult.Ye s)
{
if (Filename == null)
{
saveAsToolStrip MenuItem_Click( sender, e);
}
if (Filename != null)
{
Cover(); // get text into richTextBox7
using (StreamWriter sr = new StreamWriter(Fi lename))
{
sr.Write(richTe xtBox7.Text);
}
}
}
}
}
"Amalorpavanath an Yagulasamy(AMAL )MCP,MCS" wrote:
The following events will be called,
Deactivate
Closing
Closed

private void Form1_Closed(ob ject sender, System.EventArg s e)
{
}

private void Form1_Closing(o bject sender,
System.Componen tModel.CancelEv entArgs e)
{
}

private void Form1_Deactivat e(object sender, System.EventArg s e)
{
}

--
Regards,
Amal [MCP, MCS]
http://geocities.com/techsharing
"Scotty" wrote:
What function is called in response to a click on "Close" on system menu (the
"X" in the top right side of window)?

Nov 17 '05 #3
Check to see if the events were actually wired to the functions.

--
Jonathan Allen
"Scotty" <Sc************ **********@sil. org> wrote in message
news:BD******** *************** ***********@mic rosoft.com...
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(ob ject sender, System.EventArg s e)
// private void Form1_Closing(o bject sender,
System.Componen tModel.CancelEv entArgs e)
private void Form1_Deactivat e(object sender, System.EventArg s e)
{
DialogResult result;
if (chng == true)
{
result = MessageBox.Show ("Do you want to save your file?",
"Save?", MessageBoxButto ns.YesNoCancel, MessageBoxIcon. Exclamation);
if (result == DialogResult.Ca ncel)
return;
if (result == DialogResult.Ye s)
{
if (Filename == null)
{
saveAsToolStrip MenuItem_Click( sender, e);
}
if (Filename != null)
{
Cover(); // get text into richTextBox7
using (StreamWriter sr = new
StreamWriter(Fi lename))
{
sr.Write(richTe xtBox7.Text);
}
}
}
}
}
"Amalorpavanath an Yagulasamy(AMAL )MCP,MCS" wrote:
The following events will be called,
Deactivate
Closing
Closed

private void Form1_Closed(ob ject sender, System.EventArg s e)
{
}

private void Form1_Closing(o bject sender,
System.Componen tModel.CancelEv entArgs e)
{
}

private void Form1_Deactivat e(object sender, System.EventArg s e)
{
}

--
Regards,
Amal [MCP, MCS]
http://geocities.com/techsharing
"Scotty" wrote:
> What function is called in response to a click on "Close" on system
> menu (the
> "X" in the top right side of window)?

Nov 17 '05 #4
How do I do that? (Newbie question)

"Jonathan Allen" wrote:
Check to see if the events were actually wired to the functions.

--
Jonathan Allen
"Scotty" <Sc************ **********@sil. org> wrote in message
news:BD******** *************** ***********@mic rosoft.com...
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(ob ject sender, System.EventArg s e)
// private void Form1_Closing(o bject sender,
System.Componen tModel.CancelEv entArgs e)
private void Form1_Deactivat e(object sender, System.EventArg s e)
{
DialogResult result;
if (chng == true)
{
result = MessageBox.Show ("Do you want to save your file?",
"Save?", MessageBoxButto ns.YesNoCancel, MessageBoxIcon. Exclamation);
if (result == DialogResult.Ca ncel)
return;
if (result == DialogResult.Ye s)
{
if (Filename == null)
{
saveAsToolStrip MenuItem_Click( sender, e);
}
if (Filename != null)
{
Cover(); // get text into richTextBox7
using (StreamWriter sr = new
StreamWriter(Fi lename))
{
sr.Write(richTe xtBox7.Text);
}
}
}
}
}
"Amalorpavanath an Yagulasamy(AMAL )MCP,MCS" wrote:
The following events will be called,
Deactivate
Closing
Closed

private void Form1_Closed(ob ject sender, System.EventArg s e)
{
}

private void Form1_Closing(o bject sender,
System.Componen tModel.CancelEv entArgs e)
{
}

private void Form1_Deactivat e(object sender, System.EventArg s e)
{
}

--
Regards,
Amal [MCP, MCS]
http://geocities.com/techsharing
"Scotty" wrote:

> What function is called in response to a click on "Close" on system
> menu (the
> "X" in the top right side of window)?


Nov 17 '05 #5
Look for code like this for each event. It should be in the initialize
component method.

this.Deactivate += new System.EventHan dler(this.Form1 _Deactivate);

--
Jonathan Allen

"Scotty" <Sc************ **********@sil. org> wrote in message
news:12******** *************** ***********@mic rosoft.com...
How do I do that? (Newbie question)

"Jonathan Allen" wrote:
Check to see if the events were actually wired to the functions.

--
Jonathan Allen
"Scotty" <Sc************ **********@sil. org> wrote in message
news:BD******** *************** ***********@mic rosoft.com...
>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(ob ject sender, System.EventArg s e)
> // private void Form1_Closing(o bject sender,
> System.Componen tModel.CancelEv entArgs e)
> private void Form1_Deactivat e(object sender, System.EventArg s e)
> {
> DialogResult result;
> if (chng == true)
> {
> result = MessageBox.Show ("Do you want to save your
> file?",
> "Save?", MessageBoxButto ns.YesNoCancel, MessageBoxIcon. Exclamation);
> if (result == DialogResult.Ca ncel)
> return;
> if (result == DialogResult.Ye s)
> {
> if (Filename == null)
> {
> saveAsToolStrip MenuItem_Click( sender, e);
> }
> if (Filename != null)
> {
> Cover(); // get text into richTextBox7
> using (StreamWriter sr = new
> StreamWriter(Fi lename))
> {
> sr.Write(richTe xtBox7.Text);
> }
> }
> }
> }
> }
>
>

Nov 17 '05 #6
Great! Thanks.

I try it with
"private void Form1_Closed(ob ject sender, System.EventArg s e)"
and it worked!

Scott

"Jonathan Allen" wrote:
Look for code like this for each event. It should be in the initialize
component method.

this.Deactivate += new System.EventHan dler(this.Form1 _Deactivate);

--
Jonathan Allen

"Scotty" <Sc************ **********@sil. org> wrote in message
news:12******** *************** ***********@mic rosoft.com...
How do I do that? (Newbie question)

"Jonathan Allen" wrote:
Check to see if the events were actually wired to the functions.

--
Jonathan Allen
"Scotty" <Sc************ **********@sil. org> wrote in message
news:BD******** *************** ***********@mic rosoft.com...
>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(ob ject sender, System.EventArg s e)
> // private void Form1_Closing(o bject sender,
> System.Componen tModel.CancelEv entArgs e)
> private void Form1_Deactivat e(object sender, System.EventArg s e)
> {
> DialogResult result;
> if (chng == true)
> {
> result = MessageBox.Show ("Do you want to save your
> file?",
> "Save?", MessageBoxButto ns.YesNoCancel, MessageBoxIcon. Exclamation);
> if (result == DialogResult.Ca ncel)
> return;
> if (result == DialogResult.Ye s)
> {
> if (Filename == null)
> {
> saveAsToolStrip MenuItem_Click( sender, e);
> }
> if (Filename != null)
> {
> Cover(); // get text into richTextBox7
> using (StreamWriter sr = new
> StreamWriter(Fi lename))
> {
> sr.Write(richTe xtBox7.Text);
> }
> }
> }
> }
> }
>
>


Nov 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2147
by: Raymond H. | last post by:
Hello, I tried for a long time to find a means of preventing the menu of the right button of the mouse to appear in Textbox but without success because I always could found a way of making it appear as for example with the key of the menu (key on right side completely which precedes Ctrl) combined with the key Enter. Exist there a means of preventing this menu to appear even if it means to show a msgbox for saying that this key is...
2
1586
by: jrlen balane | last post by:
i am working on an MDIParentFrame and MDIChildFrame. Now, what i want to do is make the ChildFrame not that easy to close by removing the close button (the X on the right most corner of the window) if this is possible... how am i going to do this?
5
6581
by: Joseph Ellis | last post by:
Hello all. I have a family website that I have been maintaining for the past year and a half or so. It includes a photo album that has grown quite large. So far I've displayed the photo album using frames, with thumbnails on the left side of the screen and full-size images displayed on the right. But now I'm sick of frames and I'd like to use javascript to make the whole shebang cleaner and tighter. I'd like to use a table,...
2
1679
by: Michael Kalina | last post by:
Hi! On my website http://michaelsremarks.com I use an elastic layout and I would like the top left and top right corner to be "rounded". Now I am facing two problems, which I could not solve until now: 1. I do not want the layout to be fixed with pixel-size. I want it with ems. 2. I have a very special background. And I do not want to change it.
34
6469
by: Pmb | last post by:
I've been working on creating a Complex class for my own learning purpose (learn through doing etc.). I'm once again puzzled about something. I can't figure out how to overload the assignment operator. Here's what I'm trying to do. I've defined class Complex as class Complex { friend ostream &operator<<( ostream &, Complex & ); public: Complex( float = 0.0, float = 0.0 );
5
1862
by: meltedown | last post by:
I run into this problem over and over and over again and its driving me crazy. This has a menu on the floated menu on the left. The part to the left of that menu has a margin-left It look fine in firefox, but when the window is small in IE, the stuff on the right flows down and it looks UGLY. How do I get it to NOT flow in ie.
44
9455
by: Viken Karaguesian | last post by:
Hello all, On occasion I want to open hyperlinks (images, etc.) in a new window. In the past, I've used target="_blank" to open the link in a new window. However, using the "target" attribute causes my pages to fail validation (strict doctype). The validator says "There is no attribute 'target'.." So...how do I open a link in a new window, without Javscript, and pass strict validation?
3
2230
by: Kelii | last post by:
I've been beating my head against this problem for the last several days, and I haven't found a decent solution yet. So I'm turning to the group for some moral support or better yet some answers. Background: I want the user to be able to close the form by using the "x" button in the window title bar, I do not want to disable this. I have found a nice solution in the Access Developer's Handbook that disables the "x", however I am hoping...
1
5559
by: bogdan | last post by:
Hi, I have a div to provide a background image for a menu. I'd like to position the menu on the right side but I can't seem to find a right way of doing it. The only way the menu will move to the right if I set text-align=right in the div. The problem is that menu items are then also aligned on right side. Not only that but this alignment works only in IE. Could someone please let me know how to right-align the menu?
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9423
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10219
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9865
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8876
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7413
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3567
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.