Forums - C# Corner

Forum guidelines
ullas K

ullas K

  • 0
  • 55
  • 0

Closing one form while keeping other form open

Dec 2 2012 4:21 AM
    I have a Main Form which is the parent form.I open Form1 inside the parent form and Form1 has a textbox textbox1.On textbox1_textchanged event i should open Form2 and  pass a value to it keeping Form1 opened.Depending upon that value the datagridview on Form2 gets populated.Up to here it is fine.Now what i need is when i leave the Textbox1(ie,textbox1_leave event) i should close the Form2.How can i acheive that

My code for Textchanged event in Form1 is

private void textBox1_TextChanged(object sender, EventArgs e)
            bookname = textBox1.Text;
            Form2 obj = new Form2();


Thanks in advance

Answers (13)

Unlimited Flat-Free License


File APIs for .NET
Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!