title: C# change windows form to ontop after opening an AutoCAD drawing
body: <p>I have written a C# plugin for AutoCAD where the user can enter some information and afterwards the appropriate drawing should be openend.</p>
  
  <p>The actual workflow should be:</p>
  
  <ol>
  <li>I start my plugin in AutoCAD</li>
  <li>The user can input some information in a windows form which is on top of the current active drawing</li>
  <li>When the user hits the enter button a new drawing should be opend</li>
  <li>The form where the user has entered some information should be closed (which works fine)</li>
  <li>A new window form should be opend to enter some other information (not the same window as the first one) BUT IN THE NEW DRAWING</li>
  </ol>
  
  <p>The problem is that I can correctly close the first window and correclty open the new drawing. Like this:</p>
  
  <pre><code>    DocumentCollection documentCollection = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager;
  
      if (File.Exists(absoultePathOfDrawing))
      {
      Document newDrawing = documentCollection.Open(absoultePathOfDrawing, false);
      Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument = newDrawing; // this sets the new drawing as the active one ==&gt; is on top
      }
  
  Dispose(); // closes the first form
  DialogResult = DialogResult.OK; // tells my applciation that the first window was successfully closed
  </code></pre>
  
  <p>The form closes correctly and afterwards I try to open the new form with:</p>
  
  <pre><code>if (result == DialogResult.OK)
  {
        MessageBox.Show("Test");          
  
  }
  </code></pre>
  
  <p>But now the new drawing is on top and behind is the old drawing. When I switch back to the old drawing, the new MessageBox will be shown but actually this should be shown in the new drawing, because I set the active document to the new drawing.
  What am I doing wrong?</p>