Object Reference Not Set to an Instance of an Object 
Author Message
 Object Reference Not Set to an Instance of an Object

I have a VB.Net routine that opens a Visio document and deletes a shape
object as follows

    Dim vsoShape as Visio.Shape
    For Each vsoShape in vsoPage.Shapes
        vsoShape.Delete
    Next

I step through the code using the de{*filter*} and when it gets to the line
vsoShape.Delete that deletes the object, Visio deletes the object, but the
DotNet code declares an error "Object Reference Not Set to an Instance of an
Object".

The object was there when the instruction was executed, but it was deleted
by the instruction and it is naturally not there when the instruction
completes.  It looks like DotNet is declaring an error at that point because
the object is no longer there.

Has anyone else seen this problem?  Is there a solution or a work-around for
it?

Thanks,

Chuck



Mon, 21 Feb 2005 20:20:42 GMT  
 Object Reference Not Set to an Instance of an Object
I found this problem...I had some VBA code running on the
BeforeSelectionDelete event that was deleting the object.  Disabling that
code so that VBA doesn't try to delete the object at the same time VB.Net is
trying to delete it fixed it.

Thanks,

Chuck


Quote:
> I have a VB.Net routine that opens a Visio document and deletes a shape
> object as follows

>     Dim vsoShape as Visio.Shape
>     For Each vsoShape in vsoPage.Shapes
>         vsoShape.Delete
>     Next

> I step through the code using the de{*filter*} and when it gets to the line
> vsoShape.Delete that deletes the object, Visio deletes the object, but the
> DotNet code declares an error "Object Reference Not Set to an Instance of
an
> Object".

> The object was there when the instruction was executed, but it was deleted
> by the instruction and it is naturally not there when the instruction
> completes.  It looks like DotNet is declaring an error at that point
because
> the object is no longer there.

> Has anyone else seen this problem?  Is there a solution or a work-around
for
> it?

> Thanks,

> Chuck



Mon, 21 Feb 2005 22:07:38 GMT  
 Object Reference Not Set to an Instance of an Object
I found this problem...I had some VBA code running on the
BeforeSelectionDelete event that was deleting the object.  Disabling that
code so that VBA doesn't try to delete the object at the same time VB.Net is
trying to delete it fixed it.

Thanks,

Chuck

Quote:
> I have a VB.Net routine that opens a Visio document and deletes a shape
> object as follows

>     Dim vsoShape as Visio.Shape
>     For Each vsoShape in vsoPage.Shapes
>         vsoShape.Delete
>     Next

> I step through the code using the de{*filter*} and when it gets to the line
> vsoShape.Delete that deletes the object, Visio deletes the object, but the
> DotNet code declares an error "Object Reference Not Set to an Instance of
an
> Object".

> The object was there when the instruction was executed, but it was deleted
> by the instruction and it is naturally not there when the instruction
> completes.  It looks like DotNet is declaring an error at that point
because
> the object is no longer there.

> Has anyone else seen this problem?  Is there a solution or a work-around
for
> it?

> Thanks,

> Chuck



Mon, 21 Feb 2005 22:07:50 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Multiple Forms Question: Object reference not set to an instance of an object

2. Error when showing form: Object reference not set to an instance of an object

3. Object reference not set to an instance of an object

4. Please help with error: Object reference not set to an instance of an object

5. How to fix Error: Object reference not set to an instance of an object

6. Object reference not set to the instance of an object

7. Object reference not set to an instance of an object

8. Object reference not set to an instance of an object

9. Object reference not set to an instance of an object

10. New Twist on: Object reference not set to an instance of an object

11. Object reference not set to an instance of an object

12. Error: Object reference not set to an instance of an object

 

 
Powered by phpBB® Forum Software