When I add a territory (select couple of zip codes into a new territory) interactively using the active X control, how can I find the definition of that territory and a list of associated zip codes from my code?
This is a discussion on Extracting Zips form the territory (from code) within the MapPoint Desktop Discussion forums, part of the Map Forums category; When I add a territory (select couple of zip codes into a new territory) interactively using the active X control, ...
When I add a territory (select couple of zip codes into a new territory) interactively using the active X control, how can I find the definition of that territory and a list of associated zip codes from my code?
Hi,
Never done this. But I dont understeand what you ask. Can you explain with a few lines of code ?
rgds, Wilfried Mestdagh
www.mestdagh.biz
www.comfortsoftware.be
www.expertsoftware.be
MapPoint coding demo
MapPoint 2011 available, buy now
What I want to do is create a territory based on the zip codes using interactive methods, directly on the map, and then to be able to read the zip codes that make the territory from my program. In the meantime, I figured it out and here is the code:
Code:foreach (MapPoint.DataSet dset in mp.DataSets) { string st; st = dset.Name; if (dset.DataMapType == MapPoint.GeoDataMapType.geoDataMapTypeTerritory) { MapPoint.Recordset rset; string results =""; if (dset.RecordCount > 0) { rset = dset.QueryAllRecords(); rset.MoveFirst(); while (!rset.EOF) { foreach (MapPoint.Field fld in rset.Fields) { results += fld.Value.ToString() + " "; } results += "\r\n"; rset.MoveNext(); } System.Windows.Forms.MessageBox.Show(results); } } }
Hi,
thanks for feedback. I have put your code into code tags to make it more readable for others.
rgds, Wilfried Mestdagh
www.mestdagh.biz
www.comfortsoftware.be
www.expertsoftware.be
MapPoint coding demo
MapPoint 2011 available, buy now
There are currently 1 users browsing this thread. (0 members and 1 guests)