View Single Post

  #6 (permalink)  
Old 12-28-2004
Wilfried Wilfried is offline
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,123
Hi,

This is a very good idea
I made a little change to the code here:

Code:
                pp = (Pushpin)mapSelection;
                loc = MP.ActiveMap.GetLocation(80, 0, 0);
                // etc
Changed to:
Code:
                pp = mapSelection as Pushpin;
                if(pp != null) {
                    loc = MP.ActiveMap.GetLocation(80, 0, 0);
                    // etc
In this case pp will evaluate to null if mapSelection is not of type Pushpin, and in the first case if it is object of wrong type it will generate an exception because of the tyepcast.
Reply With Quote