title: Show a child form in the centre of Parent form in C#
body: <p>I create a new form and call from the parent form as follows:   </p>
  
  <pre><code>loginForm = new SubLogin();   
  loginForm.Show();
  </code></pre>
  
  <p>I need to display the child form at the centre of the parent. So,in the child form load I do the foll:`</p>
  
  <pre><code>Point p = new Point(this.ParentForm.Width / 2 - this.Width / 2, this.ParentForm.Height / 2 - this.Height / 2);
  this.Location = p;
  </code></pre>
  
  <p>But this is throwing error as parent form is null. I tried setting the Parent property as well, but didn't help. Any inputs on this?</p>