I'm a beginner in vb and mappoint. I try to learn how to use mappoint in vb thanks to the help of mappoint. But i arrive to import datas from excel into mappoint but i can't know how many pushpins there are and how can i connect them.
Is there some body who can try to help me please?????
I have written this prog :
Private Sub Form_Load()
load_mappoint
End Sub
Private Sub load_mappoint()
Dim MPApp As MapPoint.Application
Set MPApp = New MapPoint.Application
MPApp.Visible = True
MPApp.UserControl = True
OpenDataSet
End Sub
Private Sub OpenDataSet()
Dim MPApp As MapPoint.Application
Set MPApp = New MapPoint.Application
Dim objDataSets As MapPoint.DataSets
Dim objDataSet As MapPoint.DataSet
Dim zDataSource As String
zDataSource = "C:\points.xls!Feuil1!A1:B4"
Set objDataSets = MPApp.ActiveMap.DataSets
Set objDataSet = objDataSets.ImportData(zDataSource)
objDataSet.Symbol = 1
addlinetomap
End Sub
Sub addlinetomap()
Dim MPApp As MapPoint.Application
Set MPApp = New MapPoint.Application
Dim objMap As MapPoint.Map
Dim objloc1 As MapPoint.Location
Dim objloc2 As MapPoint.Location
Set objMap = MPApp.ActiveMap
MPApp.Visible = True
MPApp.UserControl = True
Set objloc1 = objMap.FindResults("Paris").Item(1)
Set objloc2 = objMap.FindResults("Marseille").Item(1)
Set objMap.Location = objloc1
objMap.Shapes.AddLine objloc1, objloc2
GetAllRecordsOnMap
End Sub
Sub GetAllRecordsOnMap()
Dim MPApp As New MapPoint.Application
Dim objDataSet As MapPoint.DataSet
Dim objRecordset As MapPoint.Recordset
Dim objField As MapPoint.Field
MPApp.Visible = True
MPApp.UserControl = True
'Set objDataSet = MPApp.OpenMap(MPApp.Path & "\Samples\toto.ptm").DataSets("toto")
Set objDataSet = MPApp.OpenMap("C:\Europe, Monde.ptm").DataSets("Europe, Monde") ' i have an error here but i don't know why, this code comes from the help.
'Extrait tous les enregistrements
Set objRecordset = objDataSet.QueryAllRecords
'Obtient les valeurs
Dim vals As String
objRecordset.MoveFirst
Do Until objRecordset.EOF
For Each objField In objRecordset.Fields
vals = vals & CStr(objField.Value) & vbTab
Next objField
vals = vals & vbCrLf
objRecordset.MoveNext
Loop
MsgBox vals
End Sub