Home > Back-end >  DevExpress control problem
DevExpress control problem

Time:10-14

Everybody is good, use DevExpress recently, I found my program many puzzling problems, for example, one of the
 program Project1. 

USES the
Forms,
Windows,
Controls,
Unit1 in 'Unit1. Pas' {Form1},
Unit2 in 'Unit2. Pas' {Form2};

{$R *. Res}

The begin
Application. The Initialize;
Application CreateForm (TForm1 Form1);
Form2:=TForm2. Create (Application);
If Form2. ShowModal=mrok then
Application. The Run
The else Application. The Terminate;
End.

In a PNG, a image of form1 figure, form2 similar to log in, the execution of the Application. After the Terminate complains, (the access violation... ), the remaining problems are in this error, have you met this kind of situation? How to solve?

CodePudding user response:

Var
LoginResult: integer;

The begin
Application. The Initialize;

Form2:=TForm2. Create (nil);
LoginResult:=Form2. ShowModal;
FreeAndNil (Form2);

If LoginResult=mrok then begin
Application CreateForm (TForm1 Form1);
Application. The Run;
End the else
Application. The Terminate;
end.

CodePudding user response:

Login interface is not doing so,
Assuming that form1 is the main window, form2
is the login windowYou should be in form1 Create hide themselves show form2, closed or shut itself down after login in form2 show form1,

CodePudding user response:

 Application. The Terminate; 

Please add
 freeandnil (form2); 
  • Related