I was hoping I could open your project with VS2005, but it is not. However I made new application in VB and copy the relevant part to see what happen. I only changed filenames and made the application visible to see if it works.
The only thing I had to do was add the type library to the project, however VS do not show me that it is added (but I dont know mutch of VB). Anyway this peace of code works here:
I also see that your project is containing an *.ocx with same name as *.ctl file. And then the function name 'UserControl_..'. Maybe this has something to do with the error ?Code:Public Class Form1 Private MyMap As MapPoint.Map Dim objApp As MapPoint.Application Private Sub UserControl_Initialize() On Error Resume Next objApp = GetObject(, "MapPoint.Application") If objApp Is Nothing Then objApp = CreateObject("MapPoint.Application") MyMap = objApp.OpenMap("C:\Program Files\Microsoft MapPoint Europe\MP2004\Samples\Sales.ptm", False) If (MyMap Is Nothing) Then MyMap = objApp.NewMap() End If Else MyMap = objApp.ActiveMap If MyMap Is Nothing Then MyMap = objApp.OpenMap("C:\Program Files\Microsoft MapPoint Europe\MP2004\Samples\Sales.ptm", False) If (MyMap Is Nothing) Then MyMap = objApp.NewMap() End If End If End If 'objApp.Visible = False objApp.Visible = True objApp.UserControl = True objApp.Activate() End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load UserControl_Initialize() End Sub End Class
Maybe other people with better knowledge of VB than me can answer here ?