After the Delphi Program is executed, it will automatically exit. · will the Last Exit be selected?

Source: Internet
Author: User

A strange problem occurs when the condition is false:

 

RET: = isboxfull (strtoint (e_boxno.text), rg_box );
If ret = true then
Begin
If application. MessageBox ('the number of tables in this box is full. Check whether the barcode is printed! ', 'System prompt', mb_yesno) = idyes then
Begin
F_main.cds_meter.close ();
F_main.sqlq_meter.params.parambyname ('boxno'). Value: = strtoint (e_boxno.text );
F_main.cds_meter.open ();
R_printinstoragenumber.print;
Rb_newbox.checked: = true;
Cds_maxboxno.close ();
Cds_maxboxno.open;
E_boxno.text: = inttostr (cds_maxboxno ['maxboxno'] + 1 );
F_main.cds_meter.close ();
F_main.sqlq_meter.params.parambyname ('boxno'). Value: = strtoint (e_boxno.text );
F_main.cds_meter.open ();
E_meterno.text: = '';
E_meterno.setfocus ();
Exit;
End
Else
Begin
If application. MessageBox ('the number of tables in this box is full. Are you sure you want to change the new box number to the database! ', 'System prompt', mb_yesno) = idyes then // you need to modify
Begin
Rb_newbox.checked: = true;
Cds_maxboxno.close;
Cds_maxboxno.open;
E_boxno.text: = inttostr (cds_maxboxno ['maxboxno'] + 1 );
F_main.cds_meter.close ();
F_main.sqlq_meter.params.parambyname ('boxno'). Value: = strtoint (e_boxno.text );
F_main.cds_meter.open ();
E_meterno.text: = '';
E_meterno.setfocus ();
End
Else
F_main.cds_meter.close ();
F_main.sqlq_meter.params.parambyname ('boxno'). Value: = strtoint (e_boxno.text );
F_main.cds_meter.open ();
E_meterno.text: = '';
E_meterno.setfocus ();
Exit;
End;
End;

 

Why is the exit statement still executed when ret = false?

 

What if I add a showmessage ('OK') Before exit? If it is added before, it will jump to exit. If it is added later, it will not jump in. This is not a hidden rule of Delphi.

 

Ah? Maybe so, Borland didn't announce it.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.