Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Results 1 to 8 of 8

help on converting vba code to visaul basic 2005 express

This is a discussion on help on converting vba code to visaul basic 2005 express within the MapPoint Desktop Discussion forums, part of the Map Forums category; Can someone help me please convent this vbaccess mappoint 2004 code to visual basic 2005 code as im trying to ...

  1. #1
    nmilne is offline Junior Member White Belt
    Join Date
    Jan 2006
    Posts
    9

    help on converting vba code to visaul basic 2005 express


    Can someone help me please convent this vbaccess mappoint 2004 code to visual basic 2005 code as im trying to convert my database to visual basic 2005 express edition many thanks if you can help me



    Code:
    Option Compare Database
    
    Private objMap As MAPPOINT.MappointControl
    Private objRoute As MAPPOINT.Route
    Private objSA As MAPPOINT.StreetAddress
    Private objPush As Pushpin
    'Private objway As Waypoints
    Private oLoc As Object
    
    
    Private Sub cmdPlot_Click()
        If txtAddress <> "" Then
            ApplyPoint
        End If
    End Sub
    
    
    Private Sub Form_Load&#40;&#41;
        Set objMap = Mapctl.Object
        objMap.NEWMAP geoMapEurope
    End Sub
    
    
    Public Function ApplyPoint&#40;&#41;
    
        If objMap Is Nothing Then Set objMap = Me!Mapctl.Object
        Set objSA = objMap.ActiveMap.ParseStreetAddress&#40;PICKUPADDRESS & " , " & PICKUPTOWN & " , " & PICKUPCOUNTY & " , " & PICKUPPOSTCODE&#41;
        Set oLoc = objMap.ActiveMap.FindAddressResults&#40;objSA.Street, objSA.City _
         , , objSA.Region, objSA.PostalCode&#41;
         
        If Not oLoc Is Nothing And oLoc.ResultsQuality <> geoNoResults Then
        
            Set objPush = objMap.ActiveMap.AddPushpin&#40;oLoc&#40;1&#41;.Location, Me.PICKUPCUSTOMER&#41;
            objPush.BalloonState = geoDisplayName
            objMap.ActiveMap.ActiveRoute.Waypoints.Add oLoc&#40;1&#41; 'Adds Awaypoint to map
            objPush.Location.GoTo
            Set objPush = Nothing
            Set oLoc = Nothing
        End If
    
    End Function

  2. #2
    nmilne is offline Junior Member White Belt
    Join Date
    Jan 2006
    Posts
    9

    triptime prob

    ok well i have just about converted the code above to vb.net
    still got a problem with the triptime code for vb.net 2005 in vba code i set a text box to short time with a input mask 00:00;0;_ then the code
    me.textbox = objmap.activemap.activeroute.triptime
    say trip is 2 hours 30min this shows in the textbox 2:30

    now in vb.net 2005 i do textbox.text = objroute.triptime
    i get back 0.235677889 if you add the numbers up that show in the textbox they will make up to 2hours 30 min

    how do i get the same result as in the vba code
    can anyone help on this please

  3. #3
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    > i get back 0.235677889

    0.2 is a lot more that 2:30. Please elaborate your question.

  4. #4
    nmilne is offline Junior Member White Belt
    Join Date
    Jan 2006
    Posts
    9

    more info

    im trying to get the textbox in vb.net to display the triptime like in summary 2hours 30 min in the textbox like this 2:30 the problem is that when i get back the time in textbox its (0.234237 sample numbers only) if you add up the numbers after the 0. this is the total time from point a to point b
    how do i get it to display in the textbox hours and min 2:30

  5. #5
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433
    Hi,

    there are 86400 seconds in a day, and 1440 minutes in a day. the dotNet clock is very simple, it is just the day count like in Delphi. So just multilpy it to get minuts or seconds. 0.5 is 6 hour etc...

    I hope I did understeand your question right !

  6. #6
    ssharkey is offline Junior Member White Belt
    Join Date
    Jan 2007
    Posts
    1

    Post Re: help on converting vba code to visaul basic 2005 express

    Quote Originally Posted by nmilne View Post

    Can someone help me please convent this vbaccess mappoint 2004 code to visual basic 2005 code as im trying to convert my database to visual basic 2005 express edition many thanks if you can help me



    Code:
    Private objMap As MAPPOINT.MappointControl
    Private objRoute As MAPPOINT.Route
    Private objSA As MAPPOINT.StreetAddress
    Private objPush As Pushpin
    'Private objway As Waypoints
    Private oLoc As Object
    etc

    ok well i have just about converted the code above to vb.net
    Any chance of seeing your converted code? I'm having a lot of hassle moving from the safe confines of VB6 & Access to VB.NET 2005. I even considered buying a later version of MapPoint making the false assumtion that Microsoft would have upgraded the programming interface - but it appears to still be a COM interface.

  7. #7
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4

    Re: help on converting vba code to visaul basic 2005 express

    Did you try to send nmilne a message via e-mail ? http://www.mapforums.com/nmilne-member.html

    It looks like the last time the person visited the board was six months ago.

    In any case, take a look at the examples and articles at --

    MapPoint Articles - MP2K Magazine

    Also, I would recommend the book --

    Programming MapPoint in .NET

    I did not have too much trouble with VB.NET and MapPoint 2004/2006, but I remember when I did have trouble it was frustrating to troubleshoot.

    Eric

  8. #8
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    Re: help on converting vba code to visaul basic 2005 express

    Hi,

    I'm having a lot of hassle moving from the safe confines of VB6 & Access to VB.NET 2005
    I use MP from within Delphi (win32) and from within C# (dotNet). There is really almost no difference.

    assumtion that Microsoft would have upgraded the programming interface - but it appears to still be a COM interface.
    Of course. If they do that then it can only be programmed from other dotNet applications while Microsoft wants to reach all programmers of course. To reach all programmers in all programming languages only COM is the one for visible controls (or a nice DLL for invisible controls).

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. converting lat lon to x y
    By Dazzer in forum MapPoint Desktop Discussion
    Replies: 7
    Last Post: 02-10-2009, 11:12 PM
  2. Basic - Zip Code Data (Bubble Diagram)
    By robertuva in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 09-27-2005, 04:01 PM
  3. Converting XY to Lat Long
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 11-22-2004, 03:35 AM
  4. Autoroute express
    By tanguy_laverdure in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 04-16-2004, 05:30 AM
  5. Controlling Autoroute from Visual Basic code
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 01-26-2004, 11:47 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96