I've got an MDIParent and I've opened a child window. I need to close the current parent if button is clicked. So I've tried the code below
private void button_log_Click(object sender, EventArgs e) { MDIParent_Main obj = new MDIParent_Main(textBox_username.Text); obj.Show(); this.Close(); } The problem is it's closing both MDIParent_Main and child form. Where is my error?
thisis also an MdiParent, then that is your answer. The form you are opening would belong tothis, so closingthiscloses all.