MapPoint Forums

MapForums

Community of MapPoint and Bing Maps Users and Developers




FindAddress Results in c#

This is a discussion on FindAddress Results in c# within the MapPoint Desktop Discussion forums, part of the Map Forums category; Hi The code below has been converted from vb.net to c# and now generates a error public void GetLatLon (string ...


Go Back   MapPoint Forums > Map Forums > MapPoint Desktop Discussion

Today's Posts Twitter Feed Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 09-20-2004
starbuck's Avatar
Member
Green Belt
 
Join Date: Oct 2003
Posts: 68
FindAddress Results in c#

Hi

The code below has been converted from vb.net to c# and now generates a
error


public void GetLatLon (string pc)
{
MapPoint.Map objMap;
MapPoint.Location objLoc;
try
{
objMap = map1.ActiveMap;
objLoc = (MapPoint.Location)(objMap.FindAddressResults("", "", "", "", pc,
MapPoint.GeoCountry.geoCountryUnitedKingdom ));
CalcPos(objMap, objLoc, globals.mapln, globals.mapLt);
objLoc = null;
objMap = null;
}
catch (Exception err)
{
Interaction.MsgBox(err.Message, 0, null);
}
}



error message = "Specified cast is not valid." is returned by line -
objLoc = (MapPoint.Location)(objMap.FindAddressResults("", "", "", "", pc,
MapPoint.GeoCountry.geoCountryUnitedKingdom ));


Any ideas folks
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 09-21-2004
starbuck's Avatar
Member
Green Belt
 
Join Date: Oct 2003
Posts: 68
FindAddress Results in c#

This did it if anyone wants to know.

public void GetLatLon (string pc)
{
try
{
MapPoint.Map objMap;
MapPoint.Location objLoc;
MapPoint.FindResults objRes;
objMap = globals.t.map1.ActiveMap;
objRes = objMap.FindAddressResults(string.Empty, string.Empty,
string.Empty, string.Empty, pc, null);
if(objRes != null && objRes.Count > 0)
{
object index = 1;
objLoc = objRes.get_Item(ref index) as MapPoint.Location;
}
objLoc = null;
objMap = null;
}
catch (Exception err)
{
Interaction.MsgBox(err.Message, 0, null);
}
}

Thanks to Chandu for the pointer.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
findaddress, results


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
FindAddress neighbourhood BE eblubber Bing Maps and MapPoint Web Service 1 03-24-2006 02:00 AM
What does it mean if FindAddress is returning null? chance1166 Bing Maps and MapPoint Web Service 0 01-12-2006 11:29 AM
problem with FindServiceSoap. findAddress() in java Anonymous MapPoint Desktop Discussion 0 04-24-2005 11:24 AM
delphi mp2k4 findaddress Anonymous MapPoint Desktop Discussion 4 03-24-2005 01:01 PM
Using MapPoint 2001 from C++ - the 'FindAddress' problem Anonymous MP2K Magazine Articles 0 08-16-2001 11:48 PM


All times are GMT -5. The time now is 11:54 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.2
MP2K Magazine
Visitor Map



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67