How to correctly rename Unit1.pas and form file? the essence of the problem is that when adding a form from one project to another, a match is found by name and the environment does not save, which is understandable ..

I also often come across a mistake in

  unit L2; 

interface

uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls, MPlayer;

type TL2 = class (TForm) // List of components and procedures present in the program private {Private declarations} public {Public declarations} end;

var L2: TL2; // Error Identifier redeclared: 'L2' a, b: Integer; // variables for calculating the area of ​​shapes x, y: Integer; // Variables of integer type that are responsible for coordinates implementation

{$ R * .dfm}

further procedures!

I will add the same file of the project itself:

  program Project1; 

uses Forms, L2 in 'L2.pas' {L2};

{$ R * .res}

begin Application.Initialize; Application.Title: = 'Lab №2'; Application.CreateForm (TL2, L2); Application.Run; end.

    3 answers 3

    Open the project with the desired form, rename it, select the "Save As" item and save as needed, where you want and with the desired name.

      On the second problem, it is not necessary to name the unit (module) and the form in this unit with the same names (identifiers).
      If this is so "vital" important, name them, for example, as Unit_L2 and Form_L2, respectively.

        L2.pas and L2.dfm if of course it is the contents of your unit1.