PDA

View Full Version : Should be Simple C#



ocinfo
02-24-2009, 07:36 AM
I'm using the book Programming MapPoint in .Net and I am having some issues getting the code examples to work. An example is what should be a relatively simple thing. Take a location entered into a text box in a windows form app and go to that location on the map.


MapPoint.Map map = axMappointControl1.ActiveMap;
MapPoint.Location currentLocation = null;
MapPoint.FindResults findResults = map.FindResults(id);
currentLocation = findResults.get_Item(ref ????);
currentLocation.GoTo();
The variable "id" is a string containing a location.

What should I be using as the ref object?

I appreciate any help.

Winwaed
02-24-2009, 07:45 AM
It should be a number. Eg. a reference to a variable holding an index number (which item you want in the list)

Richard

ocinfo
02-24-2009, 08:05 AM
I'm still a little confused. Do I need to declare something like object index = 1 and then use ref index?

Jarmin
02-24-2009, 09:33 AM
not really.
The findResult has a List of entries. You need the give the index-number of the item you wanna have. An int value. If you just have one item, it's 0. Otherwise... the index of the item you want in the list.
ok?