help on converting vba code to visaul basic 2005 express

nmilne
06-04-2006, 11:26 AM
:cry:
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 :lol:




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

nmilne
06-13-2006, 01:23 PM
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

Wilfried
06-13-2006, 03:53 PM
Hi,

> i get back 0.235677889

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

nmilne
06-14-2006, 05:37 AM
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

Wilfried
06-14-2006, 02:19 PM
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 !

ssharkey
01-23-2007, 10:37 AM
:cry:
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 :lol:




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.

Eric Frost
01-23-2007, 11:46 AM
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 (http://www.mp2kmag.com/articles.asp)

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

Wilfried
01-24-2007, 01:16 PM
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).

 
Web mp2kmag.com
mapforums.com