Click here to Skip to main content
15,394,023 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to hide the previous form when we click on new form.
I tried it by using HIDE() property.Its not working pls guide me even if it is to be used tell me where to use it.
Posted
Comments
CRDave1988 14-Feb-12 1:28am
   
How u use hide can u show ur code?

There is no member HIDE(), and such member would be a method, not a property.

There is a method Hide(), it always work. I don't know what exactly you screw up; there are many ways to do so. :-)

—SA
   
Comments
Abhinav S 14-Feb-12 3:10am
   
5!
   
Easy reading, right? :-)
Thank you, Abhinav.
--SA
example of a form.

C#
public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            Button button1 = new Button();
            button1.Text = "Click Me";
            button1.Click += new System.EventHandler(this.button1_Click);
        }

        private void button1_Click(object sender, EventArgs e)
        {
            this.Hide();

            Form f = new Form();
            f.Closed += new EventHandler(f_Closed);
            f.Show();
        }

        void f_Closed(object sender, EventArgs e)
        {
            this.Show();
        }
    }
   
Comments
   
Well, basically... I voted 4. You should not violate naming conventions; all auto-generated names should be gives semantic names, "f_Close" is redundant -- anonymous method is recommended. Not bad, anyway.
--SA
Michael dg 14-Feb-12 10:01am
   
thank you for the feedback. Next time I will try to follow the coding convention. :)
Abhinav S 14-Feb-12 3:10am
   
My 5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900