!nvoluntary call to Form.Close( ) !?!

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi!

I have a form that I open modally in an mdi-application, designed to search
for employers. The form contains a gui-component with some search criteria
input fields, a result list and a select button. If the user has selected one
of the rows in the result list, and clicks on the select button, the form is
hidden, focus returned to the caller and the application registers the
selected item the way it should.

However - (here comes the problem) - if the user has not selected a result
and clicks the select button, the form is closed, but not from my code, from
the framework! Of course, I can prevent this using the closing event of the
form but it troubles me that it happens... Does anyone know WHY?

Best regards
Carolina Berglund
 
Hello Carolina,

Maybe you are setting your select button as the form's default button.
If that's the case, change it so you use the select button's click event to verify that a result has been selected and then set the form's dialogresult property to the appropiate value.

Regards.


"Carolina" <[email protected]> escribió en el mensaje | Hi!
|
| I have a form that I open modally in an mdi-application, designed to search
| for employers. The form contains a gui-component with some search criteria
| input fields, a result list and a select button. If the user has selected one
| of the rows in the result list, and clicks on the select button, the form is
| hidden, focus returned to the caller and the application registers the
| selected item the way it should.
|
| However - (here comes the problem) - if the user has not selected a result
| and clicks the select button, the form is closed, but not from my code, from
| the framework! Of course, I can prevent this using the closing event of the
| form but it troubles me that it happens... Does anyone know WHY?
|
| Best regards
| Carolina Berglund
 
Thank you José!!! That was exactly it :-)

I don't usually use that property, but obviously I had been fooling around
with it at some point and then I forgot about it. Many thanks!
 
Back
Top