spacer1
spacer2 1_1 1_2
2_1
 Subscribe
 The MP2K Update!
 
 
 
 Magazine
Front Cover
What's New
Articles
News
Sample Data
Gallery
Advertise
About
 Features
MapPoint 2013
Press Releases
MapPoint Forums
Companies
Link to MP2Kmag
Wish List
MapPoint Trial
Authors
 Earlier Content
Past News Items
Past What's New Announcements
 Sponsors
 Order

MapPoint 2013

Programming MapPoint in .NET

MapPoint Book

  Spatial Community
SVG Tutorials
MapPoint

Map Visitors

  MAPPOINT Q & A  

Top | Post New Question | Read All | MP2K Asks Microsoft

538 stuart - December 12, 2001

Has anyone had any problems setting the value of the PreferredDeparture property in the Waypoint object? I was having problems with this a while ago, but the situation was more complicated because I was using Borland's C++ Builder. I have now re-written my code using the standard IDispatch interface, but changes to PreferredDeparture are just ignored. Unfortunately, I don't have access to a copy of VB so I'm still using C++. My code does work with MapPoint 2001 but not 2002. Has anyone tried setting PreferredDeparture in a VB application?

Answer:

I tried the following code in a VB app with the MapPoint ActiveX control called "ctlMapPoint" and a Command button called "cmdTest":

Private Sub cmdTest_Click()
On Error GoTo ErrSub
Dim objMap As MapPointCtl.Map
Dim objRoute As MapPointCtl.Route
    'Set up the application
    Set objMap = ctlMapPoint.ActiveMap
    Set objRoute = objMap.ActiveRoute
    'Add two waypoints to the map
    objRoute.Waypoints.Add objMap.FindResults("Seattle, WA").Item(1)
    objRoute.Waypoints.Add objMap.FindResults("Spokane, WA").Item(1)
    'Set the time you'd like depart from the start point
    objRoute.Waypoints.Item(1).PreferredDeparture = TimeValue("8:00:00 AM")
    objRoute.Calculate
ExitSub:
    Set objRoute = Nothing
    Set objMap = Nothing
    Exit Sub
ErrSub:
    Resume ExitSub
End Sub

This worked perfectly.

- Walt Cygan

Post New Answer / Follow-up


Google
 
MP2Kmag Internet


 Recent Discussion
 Resources


Want Your Site To Appear Here?

   © 1999-2012 MP2K. Questions and comments to: website@mp2kmag.com
  Microsoft and MapPoint 2002/2004/2006/2009/2010/2011/2013 are either trademarks or registered trademarks of Microsoft.