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.
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.