Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6666513
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:50:11+00:00 2026-05-26T02:50:11+00:00

I have put together this code for creating a dynamic form unit Unit1; interface

  • 0

I have put together this code for creating a dynamic form

unit Unit1;

 interface

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

  type
    TForm1 = class(TForm)
   Button1: TButton;
   procedure Button1Click(Sender: TObject);
  private
   { Private declarations }
  public
   { Public declarations }
  end;


  type
    TForm2 = class(TForm)
     private
       { Private declarations }
    public
      { Public declarations }
    end;

  var
    Form2: TForm2;
    Form1: TForm1;

implementation

  {$R *.dfm}

  procedure TForm1.Button1Click(Sender: TObject);
 var
     a:TForm2;
 begin
     a:=TForm2.Create(nil);
   end;

end.

I get an error saying resource tform2 cannot be found. What must i do?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:50:12+00:00Added an answer on May 26, 2026 at 2:50 am

    You are calling the TForm.Create() constructor that loads the TForm contents from a DFM, but your project does not have a DFM for TForm2, which is why you are getting the resource error. To skip that, you need to use the TForm.CreateNew() constructor instead.

    procedure TForm1.Button1Click(Sender: TObject);
    var
      a: TForm2;
    begin
      a := TForm2.CreateNew(nil, 0);
      ...
    end;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have put together this little script which uses a list of words to
I have put together this code Selected rows into clipboard from a lisview. procedure
I'm trying to minimize my code and have put together this little snippet, it
I have put this code together to create a table, but when I include
I have a utility that I put together that uses the .NET Framework to
I have MANY small Test Projects where I put together just enough code to
I have 2 blocks of code, if someone could help me put them together
I have put together the following code, the problem is that each while loop
I have put together a HTTP driven API using the WCF WebAPI that uses
I have put together the following mootools script window.addEvent('domready', function() { var shouts =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.