<?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: NullReferenceException while Initializing Database Object in C# in ObjectARX Forum</title>
    <link>https://forums.autodesk.com/t5/objectarx-forum/nullreferenceexception-while-initializing-database-object-in-c/m-p/1162300#M28542</link>
    <description>Your code looks correct to me, though I'm not sure about the "@" symbol in "oAutoCADDB.ReadDwgFile(@"D:\\Sample Files\09-03-0006-00.dwg", System.IO.FileShare.Read, false, "");".  I would also think it would be a good idea to escape the second backslash.&lt;BR /&gt;
&lt;BR /&gt;
At which line is the error generated? &lt;BR /&gt;
If you comment out all other code would this work? :&lt;BR /&gt;
&lt;BR /&gt;
Database oAutoCADDB;   /*you do not need to set the object to null when you declare it*/&lt;BR /&gt;
oAutoCADDB = new Database(false, true);</description>
    <pubDate>Tue, 19 Oct 2004 19:45:08 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2004-10-19T19:45:08Z</dc:date>
    <item>
      <title>NullReferenceException while Initializing Database Object in C#</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/nullreferenceexception-while-initializing-database-object-in-c/m-p/1162299#M28541</link>
      <description>I am trying to read the Document Properties. &lt;BR /&gt;
I get "System.NullReferenceException : Object reference not set to an instance of an object" error when i create a new instance of Database class.&lt;BR /&gt;
oAutoCADDB = new Database(false, true);&lt;BR /&gt;
&lt;BR /&gt;
I would really appreciate if anyone can help me my mistakes here?&lt;BR /&gt;
&lt;BR /&gt;
private void DisplayProperties()&lt;BR /&gt;
{&lt;BR /&gt;
Database oAutoCADDB = null;&lt;BR /&gt;
try&lt;BR /&gt;
{&lt;BR /&gt;
oAutoCADDB = new Database(false, true);&lt;BR /&gt;
oAutoCADDB.ReadDwgFile(@"D:\\Sample Files\09-03-0006-00.dwg", System.IO.FileShare.Read, false, "");&lt;BR /&gt;
&lt;BR /&gt;
MessageBox.Show("LastSavedAsVersion:" + oAutoCADDB.LastSavedAsVersion.ToString());&lt;BR /&gt;
&lt;BR /&gt;
DatabaseSummaryInfo oDBSummaryInfo = oAutoCADDB.SummaryInfo;&lt;BR /&gt;
MessageBox.Show("Author:" + oDBSummaryInfo.Author);&lt;BR /&gt;
MessageBox.Show("Comments:" + oDBSummaryInfo.Comments);&lt;BR /&gt;
MessageBox.Show("Keywords:" + oDBSummaryInfo.Keywords);&lt;BR /&gt;
MessageBox.Show("LastSavedBy:" + oDBSummaryInfo.LastSavedBy);&lt;BR /&gt;
MessageBox.Show("RevisionNumber:" + oDBSummaryInfo.RevisionNumber);&lt;BR /&gt;
MessageBox.Show("Subject:" + oDBSummaryInfo.Subject);&lt;BR /&gt;
MessageBox.Show("Title:" + oDBSummaryInfo.Title);&lt;BR /&gt;
MessageBox.Show("HyperlinkBase:" + oDBSummaryInfo.HyperlinkBase);&lt;BR /&gt;
&lt;BR /&gt;
StringDictionary oStrDictionary = oDBSummaryInfo.CustomProperties;&lt;BR /&gt;
&lt;BR /&gt;
foreach ( DictionaryEntry de in oStrDictionary)&lt;BR /&gt;
MessageBox.Show("" + de.Key + ":" + de.Value);&lt;BR /&gt;
&lt;BR /&gt;
oAutoCADDB.CloseInput(true);&lt;BR /&gt;
}&lt;BR /&gt;
catch(Exception ex)&lt;BR /&gt;
{&lt;BR /&gt;
if(oAutoCADDB != null)oAutoCADDB.CloseInput(true);&lt;BR /&gt;
MessageBox.Show(ex.ToString());&lt;BR /&gt;
}		&lt;BR /&gt;
}</description>
      <pubDate>Tue, 19 Oct 2004 16:41:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/nullreferenceexception-while-initializing-database-object-in-c/m-p/1162299#M28541</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-10-19T16:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: NullReferenceException while Initializing Database Object in C#</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/nullreferenceexception-while-initializing-database-object-in-c/m-p/1162300#M28542</link>
      <description>Your code looks correct to me, though I'm not sure about the "@" symbol in "oAutoCADDB.ReadDwgFile(@"D:\\Sample Files\09-03-0006-00.dwg", System.IO.FileShare.Read, false, "");".  I would also think it would be a good idea to escape the second backslash.&lt;BR /&gt;
&lt;BR /&gt;
At which line is the error generated? &lt;BR /&gt;
If you comment out all other code would this work? :&lt;BR /&gt;
&lt;BR /&gt;
Database oAutoCADDB;   /*you do not need to set the object to null when you declare it*/&lt;BR /&gt;
oAutoCADDB = new Database(false, true);</description>
      <pubDate>Tue, 19 Oct 2004 19:45:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/nullreferenceexception-while-initializing-database-object-in-c/m-p/1162300#M28542</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-10-19T19:45:08Z</dc:date>
    </item>
    <item>
      <title>Re: NullReferenceException while Initializing Database Object in C#</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/nullreferenceexception-while-initializing-database-object-in-c/m-p/1162301#M28543</link>
      <description>Thanks for the Prompt Response.&lt;BR /&gt;
&lt;BR /&gt;
I get an error at oAutoCADDB = new Database(false, true); itself. so i can't debug further to see if the code works.&lt;BR /&gt;
&lt;BR /&gt;
I am running AutoCAD 2005. But i want to run this program as a Standalone Program using ObjectARX with no dependency of Invoking Heavy Weight AutoCAD 2005 UI Process. Righ now i am running the above mentioned code in a .NET Windows Forms Application for testing.&lt;BR /&gt;
&lt;BR /&gt;
I thought ObjectARX is a Light Weight Alternative to build AutoCAD applications instead of using AutoCAD Software and Automation APIs. Is my statement Wrong?</description>
      <pubDate>Tue, 19 Oct 2004 21:03:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/nullreferenceexception-while-initializing-database-object-in-c/m-p/1162301#M28543</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-10-19T21:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: NullReferenceException while Initializing Database Object in C#</title>
      <link>https://forums.autodesk.com/t5/objectarx-forum/nullreferenceexception-while-initializing-database-object-in-c/m-p/1162302#M28544</link>
      <description>If you want to write a standalone application, you need to use ObjectDBX, to run ObjectARX programs you absolutely have to have AutoCAD running.  ObjectARX API is a tool for customising AutoCAD, just like the API used in ADS, but is more powerful.  Thus, you have to compile your project into a .dll, and load it in AutoCAD using the "netload" command. &lt;BR /&gt;
With ObjectDBX you will not have to have AutoCAD present at all.</description>
      <pubDate>Tue, 19 Oct 2004 22:25:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/objectarx-forum/nullreferenceexception-while-initializing-database-object-in-c/m-p/1162302#M28544</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2004-10-19T22:25:46Z</dc:date>
    </item>
  </channel>
</rss>

