How to Create at Runtime Winforms

May 20 2004 3:49 PM
Hello to all: We always have developing with delphi 5 and now we are trying to start to develop with Visual C# .Net Does any one know how can I from the principal winform create other winforms at runtime? and how to prevent when the user click over the button create another instance of the second winform in other words if the second winform is already created only restore the second form and bring to front, but if the second form is not created yet, create the second form, this will posible. This is because in delphi 5 we resolving this problem with the next code: var frm : TSecondForm; ... frm := TSecondForm(Application.MainForm.FindComponent('SecondForm')); if frm = nil then begin frm := TSecondForm.Create(Application.MainForm); frm.Show; end else begin frm.WindowState := wsNormal; frm.BringToFront; end; Is this posible? , please can you provide a complete example or where can I learn more about this issues. Best Regards.

Answers (3)