title: Image button on visual studio 2010
body: <p>I am trying to create a button with image and no text from the [Design] view on Visual Studio 2010. I drag &amp; dropped the button, then I click the Image Property, I select a png image from my resource file, but the property always remain empty and the button doesn't have image neither on the [Design] view or in the compiled program.</p>
  
  <p>I tried setting the image on the Form.Designer.cs file with:</p>
  
  <pre><code>    // 
      // button1
      // 
      this.button1.Location = new System.Drawing.Point(73, 11);
      this.button1.Name = "button1";
      this.button1.Size = new System.Drawing.Size(39, 34);
      this.button1.TabIndex = 10;
      this.button1.UseVisualStyleBackColor = true;
      this.button1.Image = Properties.Resources.close_project_img;
  </code></pre>
  
  <p>And when I go to the [Design] View, I get the error :</p>
  
  <pre><code>To prevent possible data loss before loading the designer, the following errors must be resolved: 
  
  Projectitem unavailable.     
  
  Instances of this error (1)  
  
  1.   Show Call Stack  
  
  at EnvDTE.ProjectItem.get_FileCount()
  at Microsoft.VisualStudio.Design.Serialization.ResXGlobalObjectProvider.GetFileNameForProjectItem(ProjectItem item)
  at Microsoft.VisualStudio.Design.Serialization.ResXGlobalObject.BuildType()
  at Microsoft.VisualStudio.Design.Serialization.ResXGlobalObject.GetObjectType()
  at Microsoft.VisualStudio.Shell.Design.GlobalType.get_ObjectType()
  at Microsoft.VisualStudio.Shell.Design.GlobalObject.GetHashCode()
  at System.Collections.Generic.ObjectEqualityComparer`1.GetHashCode(T obj)
  at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
  at Microsoft.VisualStudio.Shell.Design.GlobalObjectService.GetGlobalObjects(Type baseType)
  at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetTypeFromGlobalObjects(String name, Boolean throwOnError, Boolean ignoreCase)
  at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name, Boolean throwOnError, Boolean ignoreCase)
  at Microsoft.VisualStudio.Design.Serialization.CodeDom.AggregateTypeResolutionService.GetType(String name)
  at System.ComponentModel.Design.Serialization.DesignerSerializationManager.GetRuntimeType(String typeName)
  at System.ComponentModel.Design.Serialization.DesignerSerializationManager.GetType(String typeName)
  at System.ComponentModel.Design.Serialization.DesignerSerializationManager.System.ComponentModel.Design.Serialization.IDesignerSerializationManager.GetType(String typeName)
  at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
  at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializePropertyReferenceExpression(IDesignerSerializationManager manager, CodePropertyReferenceExpression propertyReferenceEx, Boolean reportError)
  at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeExpression(IDesignerSerializationManager manager, String name, CodeExpression expression)
  at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializePropertyAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement, CodePropertyReferenceExpression propertyReferenceEx, Boolean reportError)
  at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeAssignStatement(IDesignerSerializationManager manager, CodeAssignStatement statement)
  at System.ComponentModel.Design.Serialization.CodeDomSerializerBase.DeserializeStatement(IDesignerSerializationManager manager, CodeStatement statement)  
  
  Help with this error  
  
  Could not find an associated help topic for this error.
  </code></pre>
  
  <p>I can click "ignore and continue" and the [Design] view opens fine, but the button doesn't show the image on that view (it does show it in the compiled program).</p>
  
  <p>What am I doing wrong here?</p>