sorry - that was me, not guest.
This is a discussion on Pushpin Names within the MapPoint Desktop Discussion forums, part of the Map Forums category; sorry - that was me, not guest....
sorry - that was me, not guest.
Hi,
Just use 'FindPushPin(name)' to return the pushpin wiht the name
rgds, Wilfried Mestdagh
www.mestdagh.biz
www.comfortsoftware.be
www.expertsoftware.be
MapPoint coding demo
MapPoint 2011 available, buy now
I did that and that works great, if I knew every pushpin name, in each set, which I don't or wont.
I was trying to query each set and have then names in a list box, each time the application loads, because I may update the map from time to time and the names may change or more pushpins maybe added.
Working off of memory I'm doing this..
Market 2303, being one of my pushpin sets. Does this properly query my pushpin set?Code:Dim objDataSet As MapPointCtl.DataSet Dim objRecordSet As MapPointCtl.Recordset Set objDataSet = objMap.DataSets("Market 2303") Set objRecordSet = objDataSet.QueryAllRecords
Then I think the rest of my code is garbage.![]()
Hi,
Yes it will properly return al reords in objDataSet.
rgds, Wilfried Mestdagh
www.mestdagh.biz
www.comfortsoftware.be
www.expertsoftware.be
MapPoint coding demo
MapPoint 2011 available, buy now
Okay, looking around here and scratching my head, I came up with this. Here's what I have to populate my list box, and it works great.
But here's what I have when I click on the pushpin name, its not working..Code:Public Sub Market1() Dim objMap As MapPointCtl.Map Set objMap = MappointControl1.ActiveMap Dim objDataSet As MapPointCtl.DataSet Dim objRecordset As MapPointCtl.Recordset Set objDataSet = objMap.DataSets("Market 2303") Set objRecordset = objDataSet.QueryAllRecords Do While Not objRecordset.EOF If InStr(1, objRecordset.Pushpin.Name, "", vbTextCompare) Then List1.AddItem objRecordset.Pushpin.Name End If objRecordset.MoveNext Loop End Sub
Code:Private Sub List1_Click() Dim objMap As MapPointCtl.Map Set objMap = MappointControl1.ActiveMap Dim objLoc As MapPointCtl.Location Set objLoc = objMap.GetLocation(List1.Index) objLoc.GoTo End Sub
Is that "getlocation" supposed to be "findpushpin" ?
Hi,
You add pushpin names to your listbox, so you have to find the pushpin by name when you click on the listbox. Something like this:
Alternatively you can get the Location from the pushpin and use this (but this is driving around):Code:PushPin PP = MP.ActiveMap.FindPushpin(TheName); if (PP != null) PP.GoTo();
Another alternative is that you hold an array of pushpins, or an array of structure that hold a location object and a pushpin name. Then you control the 'finding' yourself. It is probably faster also.Code:PushPin PP = MP.ActiveMap.FindPushpin(TheName); if (PP != null) { Location Loc = PP.Location; Loc.Goto(); }
rgds, Wilfried Mestdagh
www.mestdagh.biz
www.comfortsoftware.be
www.expertsoftware.be
MapPoint coding demo
MapPoint 2011 available, buy now
There are currently 1 users browsing this thread. (0 members and 1 guests)