title: Correct way to destroy a form and show another in Delphi
body: <p>Currently in my program I have a Startup form, and a Main form. The startup form shows for a second or two.</p>
  
  <p>Right now, I have the following code within a timer:</p>
  
  <pre><code>  frmStartup.Destroy;
  
    frmMain := TfrmMain.Create(Self);
    frmMain.Show;
  </code></pre>
  
  <p>Right now, I'm not sure if this is the correct way to do it.. It works, but when calling <code>application.Terminate();</code>
  I receive an access violation message, leading my to believe that I have done something wrong in the destruction of the startup form..</p>
  
  <p>If anyone could show the the correct procedure for doing what I want (non-modally) It would be greatly appreciated.</p>
  
  <p>Thanks in advance,</p>
  
  <p>EDIT:</p>
  
  <p>Thanks for all the feedback, I fixed my access violations by simply adding the code:</p>
  
  <pre><code>  Action := caFree;
  </code></pre>
  
  <p>Into the frmStartup.formClose method.</p>