How to find the right

Vincent BENNER
11-08-2002, 07:36 AM
Hello,

I've got a really simple question but it's a real problem
for me to find a solution.

I'd like to put a pushpin into a map with the FindAddressResults
or FindResults methods.

What I know : the STREET, the ZIP CODE and the CITY.

When I make such a test :

Dim objPIN As MapPoint.Pushpin
Dim objFR As MapPoint.FindResults

Set objFR = Me.ctrlMAPPOINT.ActiveMap.FindAddressResults("RUE DE LA MAIRIE", "DIJON", , , "21000", "FRANCE")
Set objPIN = Me.ctrlMAPPOINT.ActiveMap.AddPushpin(objFR.Item(1) , "TEST")
objPIN.Symbol = 5



The street named "RUE DE LA MAIRIE" doesn't exist in the DIJON city. So, mapPoint puts a PushPin to about 300 kms for the DIJON city !!!!

What's wrong in my code ?

Regards,

Vincent BENNER

John Meyer
11-09-2002, 06:41 AM
Vincent,

Give this sample a try, hopefully it will get you on the right track...

in this example I have 2 forms. Form1 has the map, this code is in a
command button on form2 along with 4 textboxes. a command button on
form1 opens form2.

text1 - Street Address
text2 - City
text3 - State
text4 - Zip

Dim objmap As MapPointctl.Map
Set objmap = Form1.MappointControl1.ActiveMap
Dim objFR As MapPointctl.FindResults


Set objFR = objmap.FindAddressResults(Text1.Text, Text2.Text, ,
Text3.Text, Text4.Text, geoCountryUnitedStates)

If objFR.ResultsQuality = geoFirstResultGood Then
objmap.AddPushpin objFR.Item(1), "Good Result"
Else

'show other matches if any
For i = 1 To objFR.Count
MsgBox objFR.Item(i).Name
Next
End If

Insted of showing the msgboxes you could make the textboxes on form2
combo boxes, then in the for next loop take the "objFR.Item(i).Name"
and parse it with ParseStreetAddress method and fill the combo boxes
with the results.

 
Web mp2kmag.com
mapforums.com