So I'm trying to create classes and modules to make connecting to
MapPoint a little easier (so that the items autocomplete) and I'm
running into a bit of a problem.
If I use the following code, everything seems to work:
dim mp,mymap as OLEObject
mp = new OLEObject("MapPoint.application")
mp.visible = true
mymap = mp.activemap
mymap.name = "Hello World"
But If I create a class named MapPointApplication with:
Sub Constructor()
OLEObject("{31851F82-AFE6-11D2-A3C9-00C04F72F340}")
End Sub
Function ActiveMap() As Map
Return me.value("ActiveMap")
End Function
and another class named Map with:
Sub Constructor()
OLEObject("{31851F84-AFE6-11D2-A3C9-00C04F72F340}")
End Sub
and change the code so it reads:
dim mp as MapPointApplication
dim mymap as Map
mp = new MapPointApplication
mp.Visible = true
mymap = mp.activemap 'IllegalCastException Here
mymap.Name = "Hello World!"
I get an illegalcastexception on the marked line.
I'm pulling my hair out here.... any ideas before I go bald?
GregO
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>
Search the archives:
<http://support.realsoftware.com/listarchives/lists.html>
|