Can not add image and shapefile

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

Does your png-file also have a world-file (*.wld or *.pgw). That file is needed to transform the pixels of the image to coordinates in the map.

Another problem might be the projection of the map.
What happens when you first load the shapefile and then the image?
Assuming the shapefile has a *.prj file, the maps projection will be set to the projection of the shapefile. When you now load the image and it doesn’t have a *.prj file the projection of the map will be used and the files should align. MapWindow5 is all handling this for you, but in MWGis you need to code it yourself.

That’s why I always suggest users to write plug-ins for MW5 instead of a custom application.