title: How to create a form programmatically with a couple components on it in Delphi
body: <p>I'm working with Delphi 7 and I'm trying to create a form programmatically. Here's my form class stub:</p>
  
  <pre><code>unit clsTStudentInfoForm;
  
  interface
  
      uses Forms;
  
      type
          TStudentInfoForm = class (TForm)
  
          end;
  
  implementation
  
  
  end.
  </code></pre>
  
  <p>I also have a button on my main form (that's just a regular form that's supposed to create and show the form above at run-time) and when clicked it creates and shows the student form as a modal window. It does show the form but there's nothing on it. The only thing you can do is click the close button at the upper-right corner of the window to close it.</p>
  
  <pre><code>procedure TLibraryForm.btnShowStudentIfoFormClick(Sender: TObject);
  var
      f : TStudentInfoForm;
  begin
      f := TStudentInfoForm.CreateNew(Self);
      f.ShowModal;
      f.Free;
      f := nil;
  end;
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/YYuzC.png" alt="enter image description here"></p>
  
  <p>I have no idea how to add components to a programmatically-created form (not at run-time, but to the source code). Can you help me write some code that adds an Okay button to the student form as well as sets the caption and the form's height and width (the code has to be written in the student form file)?</p>
  
  <p>Any suggestions and examples will be highly appreciated. Thank you.</p>