control the form closing

I have a main form, and it has a button to open a new form.
The second form has textboxes and a button. When the user clicked the button,
it must be controlled the textbox is fiiled. If it is empty, a message is shown to the user and the user must see the second form to fill the textbox.
In my code, when the message is shown, the second form is closed.
How can I do this?

This part is the click button function in the first form:
1
2
3
deneme::AddTechType^ addtechtype = gcnew deneme::AddTechType;
if(addtechtype->ShowDialog() == System::Windows::Forms::DialogResult::OK )
MessageBox::Show( "The create button on the form was clicked." );


This part is the click button function in the second form:
1
2
3
4
5
if( String::IsNullOrEmpty(projectName->Text)){
this->DialogResult = System::Windows::Forms::DialogResult::Cancel; MessageBox::Show( "The OK button on the form was clicked." );
 }
 else
 this->DialogResult =  System::Windows::Forms::DialogResult::OK;
Topic archived. No new replies allowed.