MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




FindAddress Results in c#

This is a discussion on FindAddress Results in c# within the MapPoint 2006/2009 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 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #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 MapPoint Web Service and Virtual Earth 1 03-24-2006 03:00 AM
What does it mean if FindAddress is returning null? chance1166 MapPoint Web Service and Virtual Earth 0 01-12-2006 12:29 PM
problem with FindServiceSoap. findAddress() in java Anonymous MapPoint 2006/2009 Discussion 0 04-24-2005 12:24 PM
delphi mp2k4 findaddress Anonymous MapPoint 2006/2009 Discussion 4 03-24-2005 02:01 PM
Using MapPoint 2001 from C++ - the 'FindAddress' problem Anonymous MP2K Magazine Articles 0 08-17-2001 12:48 AM


All times are GMT -5. The time now is 09:46 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
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