title: DirectX InvalidCallException unhandled
body: <p>I am getting an unhandled exception when trying to create a D3d device. </p>
  
  <p>This is literally the whole code in C#.  I am just testing and trying to learn directx.
  I am getting the Unhandled exception on this line 
  : <code>device = new Device(0, DeviceType.Hardware, this,CreateFlags.SoftwareVertexProcessing, presentParams);</code></p>
  
  <pre><code>    using System;
      using System.Collections.Generic;
      using System.ComponentModel;
      using System.Data;
      using System.Drawing;
      using System.Text;
      using System.Windows.Forms;
      using Microsoft.DirectX;
      using Microsoft.DirectX.Direct3D;
  
      namespace WindowsFormsApplication2
      {
      public partial class Form1 : Form
      {
  
          public Form1()
          {
              InitializeComponent();
              Device device = null;              // Create rendering device
              PresentParameters presentParams = new PresentParameters();
  
              device = new Device(0, DeviceType.Hardware, this,CreateFlags.SoftwareVertexProcessing, presentParams);
  
              RenderToSurface render = new RenderToSurface(device, 300, 300, Format.D32, true, DepthFormat.D32);           
  
          }
  
          private void Form1_Load(object sender, EventArgs e)
          {
  
          }
      }
  }
  </code></pre>
  
  <p>Kind of blowing my mind because it looks like all the params are right..</p>