MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




Problems with Pushpin dataset

This is a discussion on Problems with Pushpin dataset within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi everyone, MapPoint 2002, VB6 I’m using the map to show live vehicle with, for each vehicle, a different pushpin ...


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

Today's Posts Twitter Feed 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 11-20-2002
Junior Member
Yellow Belt
 
Join Date: Aug 2002
Posts: 12
Problems with Pushpin dataset

Hi everyone,

MapPoint 2002, VB6

I’m using the map to show live vehicle with, for each vehicle, a different pushpin and each vehicle bellows to its own datasets. (Vehicle “Truck1”, with its bread crumps, is part of dataset “Truck1” with a different pushpin name for each of its bread crumps).

Everything works fine until I use the “Find” command on the navigation toolbar, the “Find” form of MapPoint starts to blink and is not accessible.
I trap the error “-2147418111 : Method 'DataSets' of object '_Map' failed”. If I click on the map or on VB, it gives me the famous “switch to” message.

In the program, if I do a “resume next”, it’s doing the same. This error only occurs when I click the find and occurs with one or many live vehicle on the map. Is there anyway of trapping the click event on the “Find”? Any help/suggestions will be welcome.

Sylvain
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 11-20-2002
Junior Member
Yellow Belt
 
Join Date: Aug 2002
Posts: 12
Take two,

I’ve change my code to use the “FindPushpPin” instead of “QueryAllRecords” and I still have the same problem with the “Find” of navigation toolbar with a similar error message.

Sylvain
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 11-20-2002
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
I think you will have to post the code behind your find button before we can help you debug it.
__________________
John
http://www.support-pc.com

Order MapPoint 2006 Here
https://secure.mp2kmag.com/?refer=support-PC
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 11-20-2002
Junior Member
Yellow Belt
 
Join Date: Aug 2002
Posts: 12
Hi John,

The code I use with the DataSet is:

Set objRecordset = pubMap.DataSets(VehicleInfo(Index).VehicleNm).Quer yAllRecords

and it the problem occurs on the "Set".

I've change my code to use the the following
Set objPushPin = pubMap.FindPushpin(VehicleInfo(Index).VehicleNm)

and same thing happen on the 'Set'. The code works fine until I click on the 'Find' of the 'Navigation Toolbar'. I've also reinstall MapPoint and the same thing. I test it on 2 computers without a programming environment and the same error.

Sylvain
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 11-20-2002
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
Here are two samples. Lets say your Dataset was named Test and your pushpin was named Home.

Dim objMap As MapPointctl.Map
Set objMap = MappointControl1.ActiveMap
Dim objDataSet As MapPointctl.DataSet
Dim objRecords As MapPointctl.Recordset

Set objDataSet = objMap.DataSets("Test")
Set objRecordset = objDataSet.QueryAllRecords
'//////////////////////////////////////////////////////
Dim objPin As MapPointctl.Pushpin
Set objPin = objMap.FindPushpin("Home")
__________________
John
http://www.support-pc.com

Order MapPoint 2006 Here
https://secure.mp2kmag.com/?refer=support-PC
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 11-21-2002
Junior Member
Yellow Belt
 
Join Date: Aug 2002
Posts: 12
Hi John,

Thank you for taking the time, I've changed the code to use the dataset again and used the following code:

Dim objRecordset As MapPointctl.Recordset
Dim objDataSet As MapPointctl.DataSet

Set objDataSet = pubMap.DataSets(VehicleInfo(Index).VehicleNm)
Set objRecordset = objDataSet.QueryAllRecords

Again the same problem on the first 'set'. I'm sorry for repeating myself but this code works for hours without a problem and the only problem is when the 'Find' of the toolbar is used.

I've added the following to look at the dataset, the proper name shows but again the same error occurs when I used the find. The error stop on the 'For'.

For intCnt = 1 To pubMap.DataSets.Count
Debug.Print pubMap.DataSets(intCnt).Name
Next

Sylvain
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 11-21-2002
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
Sylvain,

When you hit the "Find" button, what information are you passing to your code?

What is VehicleNm? Is that a pushpin?

In one of your posts you mentioned a dataset named "Truck1"
If that is the name of a dataset on your map, you could use the following to set a reference to dataset "Truck1"

Set objDataSet = pubMap.DataSets("Truck1")

'This sample might help.

Dim objMap As MapPointctl.Map
Set objMap = MappointControl1.ActiveMap
Dim objDataSet As MapPointctl.DataSet
Dim objRecords As MapPointctl.Recordset


Set objDataSet = objMap.DataSets("Truck1")
Set objRecordset = objDataSet.QueryAllRecords

Do While Not objRecordset.EOF
Debug.Print objRecordset.Pushpin.Name
objRecordset.MoveNext
Loop
__________________
John
http://www.support-pc.com

Order MapPoint 2006 Here
https://secure.mp2kmag.com/?refer=support-PC
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 11-21-2002
Junior Member
Yellow Belt
 
Join Date: Aug 2002
Posts: 12
Hi John,
THis following code is a sub set of what I use. Just create a form, add 2 command button, a timer, and a mapcontrol. A lot of comments were removed to it smaller.

The command1 starts the timer, the timer displays icons with 5 bread crumbs, click on the find of the toolbar and wait 5 seconds. (Please tell me you have the same error.)

Thanks,
Sylvain
Code:
Option Explicit

Public pubMap As MapPointCtl.Map
Public privPushPinName As String
Public privRecCnt As Integer

Public Sub subDataSetExist(ByVal pDataSetName As String)
    
    Dim boolDataSetFound As Boolean
    Dim intCnt As Integer
    boolDataSetFound = False
    For intCnt = 1 To pubMap.DataSets.Count
        If pubMap.DataSets(intCnt).Name = pDataSetName Then
            boolDataSetFound = True
            Exit For
        End If
    Next
    ' If the Data Set was not found, create the Data Set
    If Not boolDataSetFound Then
        pubMap.DataSets.AddPushpinSet pDataSetName
    End If

End Sub


Private Sub Command1_Click()
    privRecCnt = 0
    subDataSetExist privPushPinName
    Me.Timer1.Interval = 5000
    Me.Timer1.Enabled = True
End Sub

Private Sub Command2_Click()
    Me.Timer1.Enabled = False
    Me.Timer1.Interval = 0
End Sub

Private Sub Form_Load()
    privPushPinName = "Truck"
    Me.MappointControl1.NewMap (geoMapNorthAmerica)
    Set pubMap = Me.MappointControl1.ActiveMap
    pubMap.Application.Toolbars.Item("Navigation").Visible = True
End Sub


Private Sub Form_Unload(Cancel As Integer)

    If Not (pubMap Is Nothing) Then
        pubMap.Saved = True
        pubMap.Application.Quit
    End If

End Sub


Private Sub Timer1_Timer()

    Dim objLoc As MapPointCtl.Location
    Dim objPushPin As MapPointCtl.Pushpin
    Dim objRecordset As MapPointCtl.Recordset
    Dim objDataSet As MapPointCtl.DataSet
    Dim dblLatitude As Double
    Dim dblLongitude As Double
    Dim lngX As Long
    Dim lngY As Long
    Dim intBreadCrumbs As Integer
    Dim strTemp As String

    privRecCnt = privRecCnt + 1
    
    dblLatitude = CDbl(45.56868)
    dblLongitude = CDbl(-73.60147)
    
    ' Just to move the Icon
    dblLatitude = dblLatitude + CDbl(privRecCnt / 1000)
    dblLongitude = dblLongitude + CDbl(privRecCnt / 1000)

    ' Retrieve the Dataset for this vehicle
    Set objDataSet = pubMap.DataSets(privPushPinName)
    Set objPushPin = Nothing
    
    ' Use to query all the records
    Set objRecordset = objDataSet.QueryAllRecords
    
    ' Go to the first one, just in case...
    objRecordset.MoveFirst
    
    ' Retrieve the vehicle in the DataSet
    Do While Not objRecordset.EOF
        If objRecordset.Pushpin.Name = privPushPinName Then
            Set objPushPin = objRecordset.Pushpin
            Exit Do
        End If
        objRecordset.MoveNext
    Loop
    
    If Not (objPushPin Is Nothing) Then
        
        intBreadCrumbs = privRecCnt Mod 5
            
        ' Create a Unique Name for the Vehicle Push Pin
        strTemp = "Crumbs " & CStr(intBreadCrumbs) & " of " & privPushPinName

        objRecordset.MoveFirst
        Do While Not objRecordset.EOF
            ' The bread crumbs name was found
            If objRecordset.Pushpin.Name = strTemp Then
                ' Delete this pushpin before changing the name of the original one
                ' to that Bread Crumbs.
                objRecordset.Pushpin.Delete
                Exit Do
            End If
            objRecordset.MoveNext
        Loop
        
        objPushPin.Name = strTemp
        
    End If

    With pubMap
        Set objLoc = .GetLocation(dblLatitude, dblLongitude)
        ' Add the pushpin to the Original name.
        Set objPushPin = .AddPushpin(objLoc, privPushPinName)
    End With
        
    objPushPin.BalloonState = geoDisplayName
    
    objPushPin.MoveTo pubMap.DataSets.Item(privPushPinName)
    
    lngX = pubMap.LocationToX(objLoc)
    lngY = pubMap.LocationToY(objLoc)
    
    If (lngX < 0 Or lngX > pubMap.Width) Or (lngY < 0 Or lngY > pubMap.Height) Then
        objPushPin.Location.GoTo
    End If
            
    Set objPushPin = Nothing
    Set objDataSet = Nothing
    Set objRecordset = Nothing
    
End Sub
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 11-21-2002
John Meyer's Avatar
Senior Member
Blue Belt
 
Join Date: Jul 2002
Posts: 479
Sylvain,

I have only looked at the code for a few moments but I have to ask you why is it nessasary to run the code within the Timer1 Control EVERY 5000 milliseconds (12 times per second)?

I think maybe you are overloading the system?

What version of windows are you running? If you have NT/Win2000/XP I would be intrested to see CPU usage as time goes on after you start this Timer Control.

Please let me know what you think.
__________________
John
http://www.support-pc.com

Order MapPoint 2006 Here
https://secure.mp2kmag.com/?refer=support-PC
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10 (permalink)  
Old 11-22-2002
Junior Member
Yellow Belt
 
Join Date: Aug 2002
Posts: 12
John, it works on 98/ME/NT/XP with other application running at the same time. I never used a timer before but I did not find it to be that bad on CPU. So far, it never created a problem or conflict with other apps.

The test I send you was every 5 seconds just for testing; the live system retrieve the information from 1 to 6 times a minute, depending how often the user has to see the information.

The timer is just one way of avoiding doing a push from the server to the client. The real code retrieves the records from a SQL server every elapse time.

Sylvain
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
dataset, problems, pushpin


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
PushPin dataset is saved in .ptm? PeppeM MapPoint 2006/2009 Discussion 1 05-06-2006 12:53 PM
Add a newly created Pushpin to Dataset Yazzy MapPoint 2006/2009 Discussion 1 08-24-2005 01:46 PM
Having problems getting location from pushpin Anonymous MapPoint 2006/2009 Discussion 0 11-02-2004 10:33 AM
delphi iterate pushpin dataset merlino MapPoint 2006/2009 Discussion 1 10-12-2004 09:20 AM
Find Nearby Pushpin in dataset Dazzer Products: Pushpin Tool, Single State Mapper 1 10-16-2003 03:05 PM


All times are GMT -5. The time now is 11:07 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0 RC2
MP2K Magazine
Visitor Map

Costa Brava Holiday
Beautiful kilometres of sandy beaches await you should you choose a Costa Brava holiday through UlookUbook!



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