2013-03-07 51 views
0

我正在使用Microsoft MapPoint 18.0對象庫作爲VB 6.0中的參考。創建對象並傳遞地址參數後,程序不會返回任何有效地址的經度,緯度數據。想知道這是否是VB 6.0的dll問題?VB 6.0中的Microsoft MapPoint 18.0對象庫

+2

你應該可以,但我們不知道你在做什麼。發佈你的代碼並描述它出錯的地方。有效的對象是否被返回?你有沒有檢查他們的其他屬性?等 – winwaed 2013-03-08 12:48:39

回答

3

我只是做了使用參考「微軟MapPoint 19.0對象庫(北美)」和下面的代碼爲我工作快速測試:

Private Sub Command1_Click() 
Dim mmpApp As MapPoint.Application, mmpMap As MapPoint.Map, _ 
     mmpFindResults As MapPoint.FindResults 

Set mmpApp = New MapPoint.Application 
Set mmpMap = mmpApp.ActiveMap 

Set mmpFindResults = mmpMap.FindAddressResults(_ 
     "24 Sussex Drive", _ 
     "Ottawa", _ 
     "", _ 
     "ON", _ 
     "", _ 
     MapPoint.GeoCountry.geoCountryCanada) 

If mmpFindResults.ResultsQuality = geoFirstResultGood Then 
    MsgBox "First result returned: (" & mmpFindResults(1).Latitude & "," & _ 
      mmpFindResults(1).Longitude & ")" 
Else 
    MsgBox "The search returned poor, ambiguous, or non-existent results" 
End If 

Set mmpFindResults = Nothing 
Set mmpMap = Nothing 
Set mmpApp = Nothing 
End Sub 

我期望它也將在18.0版本下工作。

+1

是的,它應該工作,但我們不知道OP是/沒有做什麼。我還會注意到,你的代碼盲目地假設返回至少有一個好結果。在獲取座標信息之前,您應該檢查結果集合的ResultsQuality屬性。 – winwaed 2013-03-08 15:18:31

+1

@winwaed感謝您的建議。我已經更新了我的答案。 – 2013-04-12 15:30:00

+1

這是一個常見的問題,我看到(「爲什麼代碼會崩潰?」) - 沒有文檔中的示例幫助排除測試! – winwaed 2013-04-17 13:10:00