Custom DataSet and adding Pushpin???

OOT
03-10-2008, 12:23 PM
There might be a better way of doing this (and if so please let me know). But what I am wanting to do is separate my PushPins into separate DataSets. So instead of all of them being in "My Pushpins" I'll have a "Customers" PushPin set and a "Stores" PushPin set.

I'm working in Visual Basic 2005. In a module I've got this code:

Public mpStores As MapPoint.DataSetOn my Form_Load, I have this code:

mpStores = objMap.DataSets.AddPushpinSet("My Stores")I have another procedure that hits a database that returns the Name, Latitude and Longitude of each Store. I loop though this code and output it my window and everything is accurate. However, when I run this code:


Dim dt As DataTable = Nothing
Dim objLoc As MapPoint.Location = Nothing
Dim objPP As MapPoint.Pushpin = Nothing
Dim objSym As MapPoint.Symbol = Nothing

For i = 0 To dt.Rows.Count - 1

objPP = objMap.AddPushpin(objLoc)
objPP.Name = dt.Rows(i).Item("upName").ToString.Trim
objSym = objMap.Symbols.Add(Application.StartupPath + "\images\" & dt.Rows(i).Item("upImage").ToString.Trim)
objPP.Symbol = objSym.ID

objPP.MoveTo(mpStores)

NextStepping through the code everything seems to work fine until I get to the last line (objPP.MoveTo(mpStores)). That line creates the following error:

Error: Value does not fall within the expected range.I'm very very new to datasets and don't really understand if what I'm proposing is the best way. I would like to keep them separate unless it is a major issue.

Thank you in advance for any/all help/suggestions/idea's/thoughts/etc. It is very much appreciated.

OOT
03-10-2008, 02:39 PM
:furious3: :censored: OK. My bad. I found the problem. The code I posted is working. But I was calling the database hit (which fills the new DataSet) before I instantiated the new DataSet (in Form_Load). :oops2:

So now I'm going to go flush my head :toilet: and then consider the appropriate method of hari-kari :hang:

I'm going to mark this resolved and then go hide in shame.

:68w: Self Esteem and Pride

Mattys Consulting
03-10-2008, 02:59 PM
OOT,

This is a newsgroup and you showed some effort.
Nothing to feel bad about.

Mike Mattys

Eric Frost
03-10-2008, 03:17 PM
Plus that is definitely the most creative use of Smilies here yet! I enjoyed reading.. :39v:

 
Web mp2kmag.com
mapforums.com