# Multiple Lables

**URL:** <https://mapwindow.discourse.group/t/multiple-lables/333>\
**Category:** MapWinGIS\
**Created:** [November 5, 2019, 11:08pm UTC](https://mapwindow.discourse.group/t/multiple-lables/333 "2019-11-05T23:08:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luis](https://avatars.discourse-cdn.com/v4/letter/l/3e96dc/32.png) [@Luis](https://mapwindow.discourse.group/u/Luis)\
**Post date:** [November 5, 2019, 11:08pm UTC](https://mapwindow.discourse.group/t/multiple-lables/333/1 "2019-11-05T23:08:20Z")

</div>

Hello, i try add multiple labels but i can’t, how is it the correct way?  
Sorry for my English and thanks.  
i try with sfMarcas.Labels.AddLabel(), but mi program it closed.

```
        Dim utils = New Utils()
        If (sfMarcas.CreateNewWithShapeID("", ShpfileType.SHP_MULTIPOINT) = False) Then
            MessageBox.Show("Fallo al crear sfMarcas: " + sfMarcas.ErrorMsg(sfMarcas.LastErrorCode()))
            Return False
        End If

        Dim options = sfMarcas.DefaultDrawingOptions
        options.PointType = tkPointSymbolType.ptSymbolPicture
        options.Picture = OpenMarker("")
        sfMarcas.CollisionMode = tkCollisionMode.AllowCollisions
        sfMarcas.Labels.Clear()
        _mDrawingHandle = AxMap1.NewDrawing(tkDrawReferenceList.dlScreenReferencedList)
        sfMarcas.Labels = AxMap1.get_DrawingLabels(_mDrawingHandle)
        sfMarcas.Labels.FrameVisible = True
        sfMarcas.Labels.FrameType = tkLabelFrameType.lfRoundedRectangle
        sfMarcas.Labels.FrameBackColor = utils.ColorByName(tkMapColor.AliceBlue)
        sfMarcas.Labels.FrameTransparency = 200

        If (sflineas.CreateNew("", ShpfileType.SHP_POLYLINE) = False) Then
            MessageBox.Show("Fallo al crear sflineas:: " + sflineas.ErrorMsg(sflineas.LastErrorCode()))
            Return False
        End If
        Dim shpMarcas = New Shape()
        shpMarcas.Create(ShpfileType.SHP_MULTIPOINT)
        Dim shpLineas = New Shape()
        shpLineas.Create(ShpfileType.SHP_POLYLINE)
        For x = 0 To 10
            If (ds.Tables("MarcasUbicacion").Rows(x).Item("Latitud").ToString <> "" And Double.TryParse(ds.Tables("MarcasUbicacion").Rows(x).Item("Latitud").ToString, lat) And ds.Tables("MarcasUbicacion").Rows(x).Item("Longitud").ToString <> "" And Double.TryParse((ds.Tables("MarcasUbicacion").Rows(x).Item("Longitud").ToString), lat)) Then
                Dim pnt = New MapWinGIS.Point()
                pnt.y = Val(ds.Tables("MarcasUbicacion").Rows(x).Item("Latitud"))
                pnt.x = Val(ds.Tables("MarcasUbicacion").Rows(x).Item("Longitud"))

                Dim Index = shpMarcas.numPoints
                shpMarcas.InsertPoint(pnt, Index)
                Index = sfMarcas.NumShapes
                Here my problem
                sfMarcas.Labels.AddLabel("prueba", pnt.x, pnt.y, 0.0, -1)

                Index = shpLineas.numPoints
                shpLineas.InsertPoint(pnt, Index)
                Index = sflineas.NumShapes
            End If
        Next
        If (sfMarcas.EditInsertShape(shpMarcas, 0) = False) Then
            MessageBox.Show("Failed to insert shape: " + sfMarcas.ErrorMsg(sfMarcas.LastErrorCode))
            Return False
        End If

        handlayerMarcas = AxMap1.AddLayer(sfMarcas, True)
        If (sflineas.EditInsertShape(shpLineas, 0) = False) Then
            MessageBox.Show("Failed to insert shape: " + sflineas.ErrorMsg(sflineas.LastErrorCode))
            Return False
        End If

        Dim pattern = New LinePattern()
        pattern = New LinePattern()

        pattern.AddLine(utils.ColorByName(tkMapColor.LightBlue), 5.0F, tkDashStyle.dsSolid)
        sflineas.DefaultDrawingOptions.LinePattern = pattern
        sflineas.DefaultDrawingOptions.UseLinePattern = True
        handlayerLineas = AxMap1.AddLayer(sflineas, True)
```

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [November 6, 2019, 1:16pm UTC](https://mapwindow.discourse.group/t/multiple-lables/333/2 "2019-11-06T13:16:19Z")

</div>

You’re mixing shapefile labels and drawinglayer labels:  
`sfMarcas.Labels = AxMap1.get_DrawingLabels(_mDrawingHandle)`

You should use [sf.Labels.Generate()](https://www.mapwindow.org/documentation/mapwingis4.9/group __labels__ management.html#ga842ae7f8aaaa19f5708d47734960f1f9)

More handy links:

- [Label class reference](https://www.mapwindow.org/documentation/mapwingis4.9/class_label.html#details)
- [Generate Labels Manually](https://www.mapwindow.org/documentation/mapwingis4.9/_generate_labels_manually_8cs-example.html)

---

<div class="post-metadata">

**Author:** ![Luis](https://avatars.discourse-cdn.com/v4/letter/l/3e96dc/32.png) [@Luis](https://mapwindow.discourse.group/u/Luis)\
**Post date:** [November 6, 2019, 5:26pm UTC](https://mapwindow.discourse.group/t/multiple-lables/333/3 "2019-11-06T17:26:38Z")

</div>

Thanks @pmeems, i have a cuestion, is it possible add the label (tooltip) at point mark? and not at the shape, or create a shape of labels.  
I want to do same in Mapwingis, thanks  
This is Gmap control

> Dim markador = New GMarkerGoogle(New PointLatLng(LatInicial, LngInicial), My.Resources.LogoEdit3)  
> markador.ToolTipText = “Prueba”  
> markador.ToolTipMode = MarkerTooltipMode.OnMouseOver

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [November 13, 2019, 11:00am UTC](https://mapwindow.discourse.group/t/multiple-lables/333/4 "2019-11-13T11:00:56Z")

</div>

Have a look at this example: [https://www.mapwindow.org/documentation/mapwingis4.9/\_tool\_tip\_8cs-example.html](https://www.mapwindow.org/documentation/mapwingis4.9/_tool_tip_8cs-example.html)

---

<div class="post-metadata">

**Author:** ![pmeems](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/pmeems/32/9_2.png) [@pmeems](https://mapwindow.discourse.group/u/pmeems)\
**Post date:** [November 26, 2019, 1:21pm UTC](https://mapwindow.discourse.group/t/multiple-lables/333/5 "2019-11-26T13:21:52Z")

</div>


