[Gambas-user] Confirm on form close

Benoît Minisini gambas at ...1...
Wed Aug 4 14:06:21 CEST 2010


> Hi,
> 
> Is there a way to confirm from a user when decides to close a form?
> 
> PUBLIC SUB Form_Close()
>   DIM retVal AS Integer
>   retval = Message.Question("Are you sure you want to exit?", "Yes", "No")
>   IF retVal = 1 THEN
>     ME.Close
>   ELSE IF retVal = 2 THEN
>     'code to prevent the form from exiting
>   ENDIF
> END
> 
> Nothing i've put there seems to have been able to stop the form from
> exiting so far.
> 
> Thanks
> Vikram
> 

You have to cancel the event with the STOP EVENT instruction.

Regards,

-- 
Benoît Minisini




More information about the User mailing list