?
Solved

How I can run a delphi program starting with FORM2 instead of FORM1

Posted on 2005-05-12
9
Medium Priority
?
463 Views
Last Modified: 2010-05-18
Hi guys,

Normally when someone writes a delphi program, the Form1 is the one who is running automatically if the system compiles properly. For some reason, I want to run first Form2 of my code instead of form2. How I can do that?

best regards
Manuel Lopez (lopem)
0
Comment
Question by:lopem
  • 3
  • 3
  • 2
8 Comments
 
LVL 8

Assisted Solution

by:RickJ
RickJ earned 200 total points
ID: 13992814
Project Options. Then set the main form.
0
 
LVL 4

Accepted Solution

by:
StevenB earned 200 total points
ID: 13992827
The main form of an application is the first one that is created in the project file. If you open the project file and change the order in which the forms are created then the main form can be changed. For example a new project with two forms will look like this:

program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Unit2 in 'Unit2.pas' {Form2};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.CreateForm(TForm2, Form2);
  Application.Run;
end.



In this example Form1 will be the main form. If you cahnge the code to:

program Project1;

uses
  Forms,
  Unit1 in 'Unit1.pas' {Form1},
  Unit2 in 'Unit2.pas' {Form2};

{$R *.res}

begin
  Application.Initialize;
  Application.CreateForm(TForm2, Form2);
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.


Then Form2 will become the main form.
0
 
LVL 4

Expert Comment

by:StevenB
ID: 13992835
As RickJ correctly points out, you can achieve the same end result by using the Main Form combo on the Forms tab of the Project Options dialog.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:lopem
ID: 13992994
Thanks! quick and precise solutions! Thanks a lot.
Manuel Lopez (lopem)
0
 
LVL 4

Expert Comment

by:StevenB
ID: 13993044
Glad to help.

Did you mean to reward RickJ for this Q, rather than me twice? I can reopen the question for you if you wanted to regrade it?
0
 
LVL 8

Expert Comment

by:RickJ
ID: 13993066
No problem to me.
Glad to help.  (Thanks for the offer StevenB).
0
 
LVL 3

Author Comment

by:lopem
ID: 13993087
Oops! please, reopen it, I made a mistake...  Sorry
(or change 50 point to each one)...
thanks and sorry again
Manuel Lopez (lopem)
0
 
LVL 3

Author Comment

by:lopem
ID: 13993301
Thank you guys... Sorry again
Manuel Lopez (lopem)
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Loops Section Overview
Suggested Courses

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question