Create a form object from its class type lazarus / 31-LCL ---------------------------------------------------------------------- Bruce44 · 2021-11-16 20:54 Hello I have two different forms type TForm 1 and TForm2. I would like to create one form object of each form type with a generic procedure Exemple : LoadForm (TForm1); LoadForm (TForm2); And the procedure : procedure LoadForm (a_form_class : TClass); var    o_form : TForm; begin    o_form := TForm(a_form_class).Create (Form_Main); end; But this crashes ! It may be not the correct syntax ! An idea ? Another suggestion ? ---------------------------------------------------------------------- howardpc · 2021-11-16 21:16 No need to reinvent the wheel. Such a routine already exists in the Forms unit, Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TApplication.CreateForm(InstanceClass: TComponentClass; out Reference); You call it thus:Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Application.CreateForm(TForm1, Form1);Application.CreateForm(TForm2, Form2); etc. ---------------------------------------------------------------------- Bruce44 · 2021-11-16 21:22 Of course ! So obvious Thanks