0

Hi there. i am new to C# programming. I am developing an updater that would update our product. I want to program the close button so if clicked the application should not close but rather hide. I have a notification icon from where the user can call it back. I want it just like in msn messenger.

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by selvaganapathy
0

try Hide and Show for the form

//Hides 
Form.Hide();
//you can use this if you are in the form's code
this.Hide();

//Show the form
Form.Show();
//in the form's code
this.Show();
0

Hi there. I have done it my self. Thought it would be better to share. What I wanted to do was to use notification Icon and when user clicks close button the applicaton should hide and the user could call it back by clicking on the notification icon.
The following is the code written in form_close event

e.cancel;
this.hide();
0

Hi,
This is working but sometimes u need to close the form then ..
Make a boolean variable. then check it for close operation.

Try

bool bUserClose = true;
    private void Form1_Click(object sender, EventArgs e)
    {
        bUserClose = false;
        Close();
    }

    private void Form1_FormClosing(object sender, FormClosingEventArgs e)
    {
        if (bUserClose)
        {
            e.Cancel = true;
            Hide();
        }
    }
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.