I have a form and when I click a button, the form closes even though I never call the close() function. The code is below:
if(group)
{
tree->Nodes->Add(textBox1->Text);
}
else
{
tree->Nodes[gIndex]->Nodes->Add(textBox1->Text);
}
textBox1->Clear();
textBox1->Focus();
that is all my button_click even does yet my form closes after the execution...why

Form Closes without this->close() being called
Dmitry Lysenko
mjepsen
Thanks for all your help i appreciate it.
Philippe Jan
Ah - one really sucky thing in .NET is that if a form opens and it has a dialog result, and it's opened by a form that also has the dialog results set up, the parent form is also closed. That's probably what triggered this behaviour, although you didn't say you were opening a form
Reformed
You're not checking that gIndex is a valid index, could that be the problem I'm thinking perhaps it's blowing up. Have you tried setting a break point and stepping through to see what happens
_w_
That's cool. The behaviour is totally illogical and stupid IMO, I can't imagine why Microsoft offer it, and it's caused me no end of grief in the past.
TomC456
I was thinking of a try/catch around the code, or going to your exceptions list and enabling all exceptions. Perhaps you're getting a quiet trap of an exception
I've encountered this recently when a thread caused an exception and the thread quietly stopped running.
Brian
Sauvere
Johodefo
What if you step on beyond there Obviously, nothing is going wrong within the call then.
vincent.wang
MartinaM