Author Topic: Attach Drawing in Map 3D  (Read 1871 times)

0 Members and 1 Guest are viewing this topic.

Muzza51

  • Guest
Attach Drawing in Map 3D
« on: July 15, 2012, 05:11:51 PM »
I am getting a "Reference to a non-shared member requires an object reference" error with the following code which is straight out of the developers guide:

The offending code is:

Public Sub AttachDrawing()
        Dim aliasList As Aliases
        aliasList = Autodesk.Gis.Map.MapApplication.Aliases  'This is the line generating the error.

Any assistance in identifying where I am going wrong would be appreciated.

n.yuan

  • Bull Frog
  • Posts: 348
Re: Attach Drawing in Map 3D
« Reply #1 on: July 16, 2012, 09:49:44 AM »
Are you using VS to write code? if yes, did you notice that after you enter "." following MapApplication, there is no interllisense prompt for you to choose a property called "Aliases"?

You should use HostMapApplicationServices' Application property (which is an instance of MapApplication) to reach Aliases:

Dim aliaseList As Aliases = Autodesk.Gis.Map.HostMapApplicationServices.Application.Aliases

HTH

Muzza51

  • Guest
Re: Attach Drawing in Map 3D
« Reply #2 on: July 16, 2012, 05:47:16 PM »
Many thanks, that fixed it. That will teach me to cut and paste instead of typing it in. :-)