closing parent form from child form

I have a problem with my forms. I have a parent and child form. In child form I have a button. I want to close parent window using button and create new instance parent form and shows new parent form. Anyone can help me? I tried

private Form1 m_parent;

        public Form2(Form1 frm1)
        {
            InitializeComponent();
            m_parent = frm1;
        }

and after that m_parent.Close(), but only what I got is both forms was closed and this is it. After m_parent i create new instance but my application was closed.

Answers


calling parent functions from child form

        Main frm = new Main();
        frm.Show();
        frm.Activate();
        this.Hide();

This will hide the current form and shows Main form.


You can get a ref from parent in child and then use close method of parent.


Need Your Help

UIPicker sizing in landscape mode

iphone cocoa-touch landscape

I am trying to develop an app with a UIPicker in landscape mode, taking up (almost) the entire width of the screen (with 5 or 6 components). Can you please tell me how to set the size of UIPicker. ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.