This project is read-only.

DrawLabel not working

May 5 at 6:06 PM
I am using VS 2013 and Mapwingis

I am able to draw points but when I try to add labels the program crashes with the following error.

System.AccessViolationException was unhandled
Message: An unhandled exception of type 'System.AccessViolationException' occurred in System.Windows.Forms.dll
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
May 27 at 7:58 PM
This is the code that I am using:
Private Sub plotlabels()

    Dim lbls As MapWinGIS.Labels

    lbls = AxMap1.get_DrawingLabels(hndsrcpnt)
    lbls.FontSize = 10
    lbls.FrameVisible = False

    For i = 1 To nummapseqs

        ProgressBar1.Value = ((i / nummapseqs) * 100)

        For j As Int32 = 1 To numshots

            If mapdata(i, j).x <> 0 Or mapdata(i, j).y <> 0 Then

                lbls.AddLabel((j + mapindex).ToString, mapdata(i, j).x, mapdata(i, j).y, 0.0, -1)

            End If

        Next j

    Next i

End Sub
May 27 at 8:46 PM
I did some testing and found that the code executes completely and the error occurs at the end when the map refreshes.