If my startform is Form1 and I will open Form2 from Form1 and press a button with this code on Form2.
Form2 will close.
Is it possible to write something here so the whole application will close wich meens both Form2 and Form1.

this->Close();

You can use the Application class from System.Windows.Forms (assuming we're talking about C++/CLI):

Application::Exit();

Thank you... That worked well...

You can use the Application class from System.Windows.Forms (assuming we're talking about C++/CLI):

Application::Exit();