ThN
ThN

Reputation: 3276

How to open Window Form?

I am learning to program in Delphi Prism and have gone through a crash course tutorial, which I thought was great. I learned a lot, but it failed to show me one very important programming technique that all window based programming languages allow the programmer to do. That is open a window from within another window like you click on a button to open a window which executes a command say Form1.Show;

I tried that but nothing happens. What am I doing wrong or how do you do that?

Thanks,

Upvotes: 0

Views: 221

Answers (1)

RRUZ
RRUZ

Reputation: 136431

First if you secondary form (the form to show) is in another namespace you must include the namespace in the uses list.

then from your code you must create a new instance and the call the show method.

check this sample (in this case the form to show is of Form2 type)

method MainForm.button1_Click(sender: System.Object; e: System.EventArgs);
var
    Aform : Form2; 
begin
    AForm:= new Form2;
    AForm.Show();  
end;

Upvotes: 2

Related Questions