Topic: How to Close Form When Switch Form

I Have  2 Form
1- frm_a (start from)
   - Button(open from b)
2- frm_b



how to edit script when click button open frm_b  and  close frm_a

My Visual Database : I Love You
Easy For Beginner Student For Me

Re: How to Close Form When Switch Form

procedure frm_a_Button_OnClick (Sender: string; var Cancel: boolean);
begin
frm_b.Show;
frm_a.Hide (or Close);
end;

Re: How to Close Form When Switch Form

If you close the main form, you close your project, you should to hide Form1, then close Form1, when Form2 is closing.


Script:

procedure Form1_Button1_OnClick (Sender: string; var Cancel: boolean);
begin
    Form2.Show;
    Form1.Hide;
end;

procedure Form2_OnClose (Sender: string; Action: string);
begin
    Form1.Close;
end;

begin
end.

Example project:

Post's attachments

Attachment icon Two forms.zip 2.39 kb, 615 downloads since 2015-06-23 

Dmitry.

Re: How to Close Form When Switch Form

Thank You very much
Thank you again by Love...

My Visual Database : I Love You
Easy For Beginner Student For Me

Re: How to Close Form When Switch Form

That's great but how do you do if you want to un-hide the 1st form? Let's say, on form2_OnClose --> back to form1 smile

Re: How to Close Form When Switch Form

tcoton

procedure Form2_OnClose (Sender: string; Action: string);
begin
    Form1.Show;
end;
Dmitry.

Re: How to Close Form When Switch Form

Oh great! I think, this is something I could use to create some kind of wizard smile Thanks Dmitry

Re: How to Close Form When Switch Form

It Work Nice !
Function Easy Fix bug By Multiple Show Form
smile Thanks Dmitry

My Visual Database : I Love You
Easy For Beginner Student For Me