开发者

How to open Window Form?

开发者 https://www.devze.com 2023-03-01 14:47 出处:网络
I am learning to program in Delphi Prism and have gone th开发者_StackOverflow中文版rough a crash course tutorial, which I thought was great. I learned a lot, but it failed to show me one very importan

I am learning to program in Delphi Prism and have gone th开发者_StackOverflow中文版rough 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,


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;
0

精彩评论

暂无评论...
验证码 换一张
取 消