Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Closing

Status
Not open for further replies.

gforrest

Programmer
Apr 26, 2000
39
CA
Hi,

I have two forms using this code:

begin
if NewTermIdEdt.Text = '' then
begin
ShowMessage('Please Enter Information');
Exit;
end

However, the two recact differently when the user clicks on the 'OK' button after the ShowMessage procedure. On one the form remains visible. On the other it closes (??). I've compared the properties of both. They're identical. Both have the ModalResult property set to, "mrOK". I don't want the second form to close but I'm not sure how to prevent it.

Any ideas?

Thanks.
 

I suspect the reason that one stays open and the other closes is that the form is not being displayed with a showModal.

Try setting the ModalResult property of your OK button to mrNone at design time and then setting ModalResult mrOK in the OnClick handler after validating the dialog box.

hope this helps...

-- Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top