MapPoint Forums

MapForums

Community of MapPoint and Virtual Earth Users and Developers




Move pins to dataset

This is a discussion on Move pins to dataset within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi all. I have a vb.net project that is going ok at the moment. I can pin all the data ...


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 (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 08-28-2008
Junior Member
Yellow Belt
 
Join Date: Aug 2008
Posts: 23
Move pins to dataset

Hi all.

I have a vb.net project that is going ok at the moment.

I can pin all the data from my sql that has a postcode.

I am looking to add an IF statement, so if the DivisionID is "North", move the pin to odsNorth (a dataset), or IF it is "South" move the pin to odsSouth.

Here is my code which will hopefully help you see what I'm jabbering on about

Code:
        If chkNorthDiv.Checked = True Then
            oMap.DataSets.AddPushpinSet("North Division")
            oDSNorth = oMap.DataSets("North Division")
            oDSNorth.Symbol = symbolNorth
        End If

        If chkSouthDiv.Checked = True Then
            oMap.DataSets.AddPushpinSet("South Division")
            oDSSouth = oMap.DataSets("South Division")
            oDSSouth.Symbol = symbolSouth
        End If


        For Each dr In dsData.Tables(0).Rows
            'If NULL data in Postcode, show message box and carry on
            If dr("PostCode") Is DBNull.Value Then
                sw.WriteLine("Null postcode value at " & dr("ServiceID") & " " & dr("Name"))
            Else
                'set FindResults to look for PostCode, not long/lat and plots Pins
                oFR = oMap.FindResults(dr("PostCode"))
                If oFR.Count > 0 Then

                    oPin = oMap.AddPushpin(oFR(1), dr("Name"))  'default balloon data unless specified from checkboxes



                    If dr("DivisionID") = "Div-N" Then
                        oPin.MoveTo(oDSNorth)
                    End If

                    If dr("DivisionID") = "Div-S" Then
                        oPin.MoveTo(oDSSouth)
                    End If


        Next
There is more stuff inside the loop but this is the essence.

I am not getting an error by the way. It is still pinning all the data, but keeping them in the default "My Pushpins"
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 08-28-2008
Junior Member
Yellow Belt
 
Join Date: Aug 2008
Posts: 23
Re: Move pins to dataset

After much reading I got there:
Code:
        oPin.MoveTo(oMap.DataSets.Item("North"))
Still think my theory of

Code:
        oPin.MoveTo(oDSNorth)
Works better though, because it just references the dataset name.
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 09-09-2008
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,177
Re: Move pins to dataset

Hi,

No, it does not reference the dataset name, it reference the dataset itself. That is not the same.
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 1 Week Ago
NickH
Yellow Belt
 
Join Date: Jun 2008
Location: Bromsgrove, UK
Posts: 21
Re: Move pins to dataset

Quote:
Originally Posted by Wilfried View Post
Hi,

No, it does not reference the dataset name, it reference the dataset itself. That is not the same.
But he IS referencing the Dataset. oDSNorth IS a dataset, not the dataset name.

This is a VB issue I have never quite got my head around. The problem is the brackets.
"oPin.MoveTo oDSNorth" or "Call oPin.MoveTo(oDSNorth)" work

"oPin.MoveTo (oDSNorth)" doesn't.

But I would have expected a 438 error? (Resume next on?)

Last edited by nickhoare; 1 Week Ago at 04:08 AM.. Reason: Correction
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 2 Days Ago
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,177
Re: Move pins to dataset

Hi,

I don't know VB, but I like to know if someone can explain the difference.

Code:
1. oPin.MoveTo oDSNorth
2. Call oPin.MoveTo(oDSNorth)
3. oPin.MoveTo (oDSNorth)
What is technically the difference to 1 and 2 ? What does the syntax "call" do?
What is technically the difference in brackets or no brackets in VB? (1 works, 3 does not)?
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, move, pins


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/move-pins-dataset-8356.html

Posted By For Type Date
The Magazine for MapPoint - MP2K Magazine This thread Refback 08-28-2008 12:50 PM

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
Move Shape - get new lat lon. tfmiltz MapPoint 2006/2009 Discussion 4 11-09-2007 08:51 AM
Disallow to move manuell added push pins Anonymous MapPoint 2006/2009 Discussion 1 03-02-2004 10:18 AM
not to move shapes Manuel MapPoint 2006/2009 Discussion 2 05-19-2003 01:46 PM
Help.! How to move a pushpin in the map. Anonymous MapPoint 2006/2009 Discussion 9 03-10-2003 05:00 PM
Ist it possible to get X, Y from mouse move blackmap MapPoint 2006/2009 Discussion 1 12-16-2002 03:54 PM


All times are GMT -5. The time now is 01:34 AM.


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

Majorca Holiday
Enjoy a Majorca holiday at a good price when you check out the offers on UlookUbook for this popular destination!

Pubs London
There are thousands of pubs in London. Fortunately you can use Qype to find the best ones nearest to you.



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