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
imaheshbabu
RobKor
What if you step on beyond there Obviously, nothing is going wrong within the call then.
eci
Aravind779
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
BJPHODGE
billoo
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.
bogdan_mabo
Thanks for all your help i appreciate it.
Steve Seeley
Bas Wildeman
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
alphadog4
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