naeema
April 28th, 2004, 02:46 PM
Hi,
I am new on VB.NET and I get the following exception. I have already installed .NET Framework 1.1.
The error come on the following code
System.NullReferenceException: Object reference not set to an instance of an object. at KiveraLocationService.RouteQueryClass.FindRoute(Location origin, LocationCollection stopovers, Location destination, Route& Route) at map.WebForm1.directions_Click(Object sender, EventArgs e) in d:\inetpub\wwwroot\map\map.aspx.vb:line 193
The code which produce this error is.
Dim lq As New KiveraLocationService.LocationQuery()
Dim rq As New KiveraLocationService.RouteQuery()
Dim address As New KiveraLocationService.Address()
Dim address2 As New KiveraLocationService.Address()
Dim choices As New KiveraLocationService.GeoChoiceCollection()
Dim choices2 As New KiveraLocationService.GeoChoiceCollection()
Dim loc As New KiveraLocationService.Location()
Dim loc2 As New KiveraLocationService.Location()
Dim locationstatus As KiveraLocationService.LOCATION_QUERY_STATUS
Dim routestatus As KiveraLocationService.ROUTE_QUERY_STATUS
Dim locCollection As New KiveraLocationService.LocationCollection()
Dim route As New KiveraLocationService.Route()
address.Create(line1.Text, line2.Text, "USA")
address2.Create(line3.Text, line4.Text, "USA")
lq.AttachConnector(conn)
locCollection.Add(loc)
Try
locationstatus = lq.Geocode(address, loc, choices)
Catch ex As Exception
lblStatus.Text = "Cannot Map Start address. Please check the server message " + ex.ToString()
Exit Sub
End Try
Try
locationstatus = lq.Geocode(address2, loc2, choices2)
Catch ex As Exception
lblStatus.Text = "Cannot Map End address. Please check the server message " + ex.ToString()
Exit Sub
End Try
Try
routestatus = rq.FindRoute(loc, locCollection, loc2, route)
Catch ex As Exception
lblStatus.Text = "Cannot Route. Please check the server message " + ex.ToString()
Exit Sub
End Try
The exception is thrown on the FindRoute function.
Anybody has any idea.
Thanks for your help.
Naeem
I am new on VB.NET and I get the following exception. I have already installed .NET Framework 1.1.
The error come on the following code
System.NullReferenceException: Object reference not set to an instance of an object. at KiveraLocationService.RouteQueryClass.FindRoute(Location origin, LocationCollection stopovers, Location destination, Route& Route) at map.WebForm1.directions_Click(Object sender, EventArgs e) in d:\inetpub\wwwroot\map\map.aspx.vb:line 193
The code which produce this error is.
Dim lq As New KiveraLocationService.LocationQuery()
Dim rq As New KiveraLocationService.RouteQuery()
Dim address As New KiveraLocationService.Address()
Dim address2 As New KiveraLocationService.Address()
Dim choices As New KiveraLocationService.GeoChoiceCollection()
Dim choices2 As New KiveraLocationService.GeoChoiceCollection()
Dim loc As New KiveraLocationService.Location()
Dim loc2 As New KiveraLocationService.Location()
Dim locationstatus As KiveraLocationService.LOCATION_QUERY_STATUS
Dim routestatus As KiveraLocationService.ROUTE_QUERY_STATUS
Dim locCollection As New KiveraLocationService.LocationCollection()
Dim route As New KiveraLocationService.Route()
address.Create(line1.Text, line2.Text, "USA")
address2.Create(line3.Text, line4.Text, "USA")
lq.AttachConnector(conn)
locCollection.Add(loc)
Try
locationstatus = lq.Geocode(address, loc, choices)
Catch ex As Exception
lblStatus.Text = "Cannot Map Start address. Please check the server message " + ex.ToString()
Exit Sub
End Try
Try
locationstatus = lq.Geocode(address2, loc2, choices2)
Catch ex As Exception
lblStatus.Text = "Cannot Map End address. Please check the server message " + ex.ToString()
Exit Sub
End Try
Try
routestatus = rq.FindRoute(loc, locCollection, loc2, route)
Catch ex As Exception
lblStatus.Text = "Cannot Route. Please check the server message " + ex.ToString()
Exit Sub
End Try
The exception is thrown on the FindRoute function.
Anybody has any idea.
Thanks for your help.
Naeem