is it happening here?
//Flightentry fe = new Flightentry(); //if i remove this code
public Passengerdetail()
{
InitializeComponent();
fe.FormClosed += new FormClosedEventHandler(fe_FormClosed); //this line gives error mentioned above.
}
because you've commented out the declaration for fe
In light of your comments, I think you want something like the following
Flightentry fe;
public Passengerdetail()
{
InitializeComponent();
fe = new Flightentry(this)
fe.FormClosed += new FormClosedEventHandler(fe_FormClosed); //this line gives error mentioned above.
}
...
private void button2_Click(object sender, EventArgs e)
{
this.Hide();
fe.Owner = this;
fe.ShowDialog();
this.Show();
}