I have main window. main.cpp
#include "mainWindow.h"
using namespace System;
using namespace System::Windows::Forms;
int main()
{
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);
Client::mainWindow mainWin;
Application::Run(%mainWin);
return 0;
}
And i have another form, which should open when the main form openning:
mainWindow.h
private: System::Void mainWindow_Shown(System::Object^ sender, System::EventArgs^ e) {
Client::logForm^ myForm = gcnew logForm();
myForm->Show();
//Client::logForm logF;
//logF.Show();
}
And my question: why using the commented code, the form opens and closes immediately, but uncommented code works good?
Thank you!