this part give object reference not set to an instance of an object massege problem :

Form1 f1 = new Form1();
f1.Show();
//////after this line
this.Close();

Hello!

I need more code in order to understand what has gone wrong. From what I understand it's the line this.Close();
That generates the error message?

Where is this line located? Is it somewhere in the code section of the Form1 class, or are you calling it in the same class as where your Form1 object is created? If that is the case, what class does this refer to?

Best regards,
Emil Olofsson

Yep, we definately need some more code to help you. It seems like this is getting disposed of somehow - could you be calling close more than once while another thread is preventing your process from closing? If you are trying to close your program altogether, calling Application.Exit() might give you better results.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.