MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




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 2006/2009 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 ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 06-04-2006
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()
    Set objMap = Mapctl.Object
    objMap.NEWMAP geoMapEurope
End Sub


Public Function ApplyPoint()

    If objMap Is Nothing Then Set objMap = Me!Mapctl.Object
    Set objSA = objMap.ActiveMap.ParseStreetAddress(PICKUPADDRESS & " , " & PICKUPTOWN & " , " & PICKUPCOUNTY & " , " & PICKUPPOSTCODE)
    Set oLoc = objMap.ActiveMap.FindAddressResults(objSA.Street, objSA.City _
     , , objSA.Region, objSA.PostalCode)
     
    If Not oLoc Is Nothing And oLoc.ResultsQuality <> geoNoResults Then
    
        Set objPush = objMap.ActiveMap.AddPushpin(oLoc(1).Location, Me.PICKUPCUSTOMER)
        objPush.BalloonState = geoDisplayName
        objMap.ActiveMap.ActiveRoute.Waypoints.Add oLoc(1) 'Adds Awaypoint to map
        objPush.Location.GoTo
        Set objPush = Nothing
        Set oLoc = Nothing
    End If

End Function
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 06-13-2006
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 06-13-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

> i get back 0.235677889

0.2 is a lot more that 2:30. Please elaborate your question.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 06-14-2006
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 06-14-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
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 !
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 01-23-2007
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.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 01-23-2007
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,480
Blog Entries: 1
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 01-24-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: help on converting vba code to visaul basic 2005 express

Hi,

Quote:
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.

Quote:
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).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
2005, basic, code, converting, express, vba, visaul


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
converting lat lon to x y Dazzer MapPoint 2006/2009 Discussion 6 08-14-2008 06:03 AM
Basic - Zip Code Data (Bubble Diagram) robertuva MapPoint 2006/2009 Discussion 1 09-27-2005 04:01 PM
Converting XY to Lat Long Anonymous MapPoint 2006/2009 Discussion 1 11-22-2004 03:35 AM
Autoroute express tanguy_laverdure MapPoint 2006/2009 Discussion 0 04-16-2004 05:30 AM
Controlling Autoroute from Visual Basic code Anonymous MapPoint 2006/2009 Discussion 1 01-26-2004 11:47 AM


All times are GMT -5. The time now is 04:09 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


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