Hello, i’m trying to make map with an image file and some shapes on top of it. I managed to make it in mapwindow and now i am trying to load it in visual studio 2017 VB.NET. I am using an example of add layers that is C# which i have converted to VB.NET. Now if i only load image i can see the image, if i only load shapefiles i can see the shapefiles also but when i try to load both i only see the image and no shapefiles even though it tells me that the files have been added.
AxMap1.RemoveAllLayers()
AxMap1.LockWindow(tkLockMode.lmLock)
Try
If (FolderBrowserDialog1.ShowDialog() = DialogResult.OK) Then
'MsgBox(FolderBrowserDialog1.SelectedPath)
Dim files As String() = Directory.GetFiles(FolderBrowserDialog1.SelectedPath)
Dim file As String
For Each file In files
Dim layerHandle As Integer
layerHandle = -1
If (file.ToLower().EndsWith(".png")) Then
''MsgBox("Found imgfiles " + file)
'Dim img As New Image()
'If (img.Open(file)) Then
' 'MsgBox("CAME")
' layerHandle = AxMap1.AddLayer(img, True)
'Else
' MessageBox.Show(img.ErrorMsg(img.LastErrorCode))
'End If
ElseIf (file.ToLower().EndsWith(".shp")) Then
'MsgBox("Found shapefiles " + file)
Dim sf As New Shapefile
If (sf.Open(file)) Then
layerHandle = AxMap1.AddLayer(sf, True)
Else
MessageBox.Show(sf.ErrorMsg(sf.LastErrorCode))
End If
End If
If (layerHandle <> -1) Then
AxMap1.set_LayerName(layerHandle, Path.GetFileName(file))
End If
Next
End If
Finally
AxMap1.LockWindow(tkLockMode.lmUnlock)
'MsgBox("Layers added to the map: " + AxMap1.NumLayers.ToString)
End Try