title: Displaying an icon in a picturebox
body: <p>I am trying to display <code>icon file</code> in a picture box. I'm using this code to set the image.</p>
  
  <pre><code>pictureBox1.Image = new Icon(openFileDialog.FileName, new Size(48, 48)).ToBitmap();
  </code></pre>
  
  <p>But I'm getting this exception.</p>
  
  <pre><code>System.ArgumentOutOfRangeException: Requested range extends past the end of the array.
     at System.Runtime.InteropServices.Marshal.CopyToNative(Object source, Int32 startIndex, IntPtr destination, Int32 length)
     at System.Runtime.InteropServices.Marshal.Copy(Byte[] source, Int32 startIndex, IntPtr destination, Int32 length)
     at System.Drawing.Icon.ToBitmap()
  </code></pre>
  
  <p>How to overcome this problem?</p>
  
  <p>Thanks.</p>