PDA

View Full Version : How to find pushpinobject in DataSet?



VC_Man
01-04-2007, 08:27 AM
Hi MP users,

Yeah I know, I ask a lot, but please, be patient with me.

Well I was looking for info how to get the right pushpinobject in a dataset using the pushpin's name. But in DataSet I couldn't find a method which makes this possible. So I found out that I might need the RecordSet. And with RecordSet I came to a dead end.

My situation is like this: In my Dataset I've for example 200 pushpins saved in it, each pushpin has a name accoording to a number. Now as a user I want to select one of those 200 pushpins on the map which than appears the adres and time in the balloon. How can I achieve that?

I thought I just use the Map.Select() which returns a Pushpin object, if a pushpin is selected and than do: SelectPushpin.GetNote(), which returns a string, with the needed info.

So whatever DataSet the pushpin belongs to, when I select it on the map, mappoint automagically returns the right pushpinobject with all its information, is that right??


Thnx for help.

Wilfried
01-04-2007, 08:34 AM
Hi,

No problem, just ask, that's wy the forum is for ;)

It is not a Dataset method, but ActiveMap method: FindPushpin(string Name) returns the pushpin with the given name.

VC_Man
01-04-2007, 09:53 AM
Well ok,

But suppose I've 3 pushpins with the SAME name, BUT each belongs to another DataSet! Than which of the 3 pushpins will I get?? :blueeek:

I thought the one with the current DataSet, or......Mappoint checks also the Lat/Lon to which the pushpin belongs, actually I don't know.


But what I mean is that if I have for example 30 pushpins, with 3 DataSet's, each containing 10 pushpins and they are all displayed on the map. Will MP check the name of a Pushpin, while there are 2 other pushpins with the same name, except that they belong to other two DataSet's? So, how is that? :confused:

I hope you understand what I mean :)

Wilfried
01-04-2007, 12:24 PM
Hi,

I never tryed to try FindPushpin method in another dataset as My Pushpins. I think it works. However if you dont have exclusive names for each pushpin it will not work. I've always used exclusive names.

But a good approach is also to use a linked list where you keep all references for your pushpins in. Then you dont need mappoint methods to find them and you have control in your own program :)