Hi I'm a beginner in Delphi and I have I big problem
I don't know how to close a form
I've a form with user and password .After verification I enter on other form.Albeit I put form1.close when I minimize form2 , form1 it on the screen and i would like to disapear but i don't know how.
Helppp.

To make a form invisible, you have to alter the booelan value of its 'VISIBLE' property.

To do this, you need the following assignment:

Form1.Visible := FALSE;
Form2.Visible := TRUE;

Form1 being the form name of the form you wish to close, and Form2 being the name of the form you wish to open.

here is another way to do what you want(MDI Childs):

1. you create another form(probably Form2 in Unit2.pas)
2. in the dpr file of your project delphi will insert another line WHICH must be deleted:

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1); { <-- This line is required DO NOT DELETE IT }
  Application.CreateForm(TForm2, Form2); { <-- This line will be deleted }
  Application.Run;
end.

3.in the unit where you want to open the window it must be used the name of the window in the "implementation"section

implementation
    uses Unit2;

4.in the onclick() event of the button which will open the window you must put the following code

form: TForm2;
begin
 form:=TForm2.Create(Self);
 form.ShowModal;
 form.Free;
end;

5. this is all about a simple application with 2 windows

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.