<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Object reference not set to an instance of an object. in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/object-reference-not-set-to-an-instance-of-an/m-p/127004#M3337</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;IMxDocument is not the same as IApplication, they are in two different co-classes.&amp;nbsp; The document is derived from the application so you can't cast a document as application but you can cast the parent of the document as application because the parent of a document is the application.&amp;nbsp; Hopefully that explanation helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Feb 2011 18:31:31 GMT</pubDate>
    <dc:creator>SteveFang</dc:creator>
    <dc:date>2011-02-09T18:31:31Z</dc:date>
    <item>
      <title>Object reference not set to an instance of an object.</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/object-reference-not-set-to-an-instance-of-an/m-p/127003#M3336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi All,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; I am using C# for ArcObjects desktop. Kindly clarify me on the below to declarations&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1.&amp;nbsp;&amp;nbsp; IApplicatin app = IMxDocument.doc as IApplication;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ----&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;-------&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;throws an exception (NUllReferenceException) when i use &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;app.OpenDocument(filename)------ where filename is a string in the openFileDialog1&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2.&amp;nbsp;&amp;nbsp;&amp;nbsp; IApplication app = (IMxDocument.doc as IDocument).Parent&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;---&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;---&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This does not throw an exception. My doubt is why does the first option throw an error while second option does not even though both IApplication &amp;amp; IDocument.Parent both refer to Application.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot in advance...!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Feb 2011 23:40:49 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/object-reference-not-set-to-an-instance-of-an/m-p/127003#M3336</guid>
      <dc:creator>Gautham_SChejarla</dc:creator>
      <dc:date>2011-02-08T23:40:49Z</dc:date>
    </item>
    <item>
      <title>Re: Object reference not set to an instance of an object.</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/object-reference-not-set-to-an-instance-of-an/m-p/127004#M3337</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;IMxDocument is not the same as IApplication, they are in two different co-classes.&amp;nbsp; The document is derived from the application so you can't cast a document as application but you can cast the parent of the document as application because the parent of a document is the application.&amp;nbsp; Hopefully that explanation helps.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Feb 2011 18:31:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/object-reference-not-set-to-an-instance-of-an/m-p/127004#M3337</guid>
      <dc:creator>SteveFang</dc:creator>
      <dc:date>2011-02-09T18:31:31Z</dc:date>
    </item>
    <item>
      <title>Re: Object reference not set to an instance of an object.</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/object-reference-not-set-to-an-instance-of-an/m-p/127005#M3338</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;IMxDocument is not the same as IApplication, they are in two different co-classes.&amp;nbsp; The document is derived from the application so you can't cast a document as application but you can cast the parent of the document as application because the parent of a document is the application.&amp;nbsp; Hopefully that explanation helps.&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks a lot....&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 10 Feb 2011 16:16:36 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/object-reference-not-set-to-an-instance-of-an/m-p/127005#M3338</guid>
      <dc:creator>Gautham_SChejarla</dc:creator>
      <dc:date>2011-02-10T16:16:36Z</dc:date>
    </item>
  </channel>
</rss>

