findNearbySpec... c# problem

luisfdo
05-25-2005, 01:49 PM
FindResults foundResults;
foundResults = findService.FindNearby(findNearbySpec);
ViewByHeightWidth[] views = new ViewByHeightWidth[1];
views=null;
views[0] = foundResults.Results[0].FoundLocation.BestMapView. ByHeightWidth;

I have this exception Object reference not set to an instance of an object.

I cannot find the problem... There are many places found in foundResults

can you help me? :(
Thank you..

Wilfried
05-25-2005, 02:21 PM
Hi,

what is the offending line of code ?

luisfdo
05-25-2005, 05:21 PM
the problem is this line

views[0] = foundResults.Results[0].FoundLocation.BestMapView. ByHeightWidth;

Gracias..

Wilfried
05-26-2005, 05:36 AM
Hi,

You set views = null; before you assign something to views[0]. You cannot assign to a null pointer. Probably that's the reasonl.

Somtthing like this is better I think:

FindResults foundResults;
foundResults = findService.FindNearby(findNearbySpec);
ViewByHeightWidth[] views = new ViewByHeightWidth[1];
// views=null; in comment
if (foundResults)
views[0] = foundResults.Results[0].FoundLocation.BestMapView. ByHeightWidth;

 
Web mp2kmag.com
mapforums.com