"used by another process" error
<p>i have an object that is being accessed by 2 events simulataneously.</p>

<p>first, a user-defined event will access it, then the projectItemsEvent_ItemAdded event, opens it again.</p>

<p>and got this error "The process cannot access the file because it is being used by another process."</p>

<p>please help! </p>

<p>thanks </p>

<p>Code Example:</p>

<pre><code>void ProjectItemEvents_ItemAdded()
{
   Util util = new Util(_applicationObject.Solution, CurrentSelectedProject)

   if (name != null)
   {
     util.AddNewObject();
   }
}

void addItem(object sender, WebReferenceEventArgs e)
{
  try
  {
    System.Threading.Thread.Sleep(4500);
    Util util = new Util(_applicationObject.Solution, CurrentSelectedProject)
    util.AddNewObject();
  }
  catch (Exception ex)
  {
  }
}
</code></pre>
