# ToolStripStatusLabel label

**URL:** <https://mapwindow.discourse.group/t/toolstripstatuslabel-label/600>\
**Category:** MapWinGIS\
**Created:** [May 29, 2020, 6:19am UTC](https://mapwindow.discourse.group/t/toolstripstatuslabel-label/600 "2020-05-29T06:19:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kayumiy](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/kayumiy/32/233_2.png) [@Kayumiy](https://mapwindow.discourse.group/u/Kayumiy)\
**Post date:** [May 29, 2020, 6:19am UTC](https://mapwindow.discourse.group/t/toolstripstatuslabel-label/600/1 "2020-05-29T06:19:57Z")

</div>

[https://www.mapwindow.org/documentation/mapwingis4.9/\_show\_attributes\_8cs-example.html](https://www.mapwindow.org/documentation/mapwingis4.9/_show_attributes_8cs-example.html)

Above link illustrates how to highlight shapes when mouse cursor is over.

`public void ShowAttributes([AxMap](https://www.mapwindow.org/documentation/mapwingis4.9/class_ax_map.html) axMap1, string dataPath, ToolStripStatusLabel label)`

{

I have to give ToolStripStatusLabel label as parameter in the method. What is the ToolStripStatusLabel label? Is it comes from From design part?  
How can I get it?

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [May 29, 2020, 6:40am UTC](https://mapwindow.discourse.group/t/toolstripstatuslabel-label/600/2 "2020-05-29T06:40:23Z")

</div>

Hello.

The example just happens to display the results in a ToolStripStatusLabel. But it doesn’t have to be that. It can be a standard Forms.Label, or a TextBox, etc.

---

<div class="post-metadata">

**Author:** ![Kayumiy](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/kayumiy/32/233_2.png) [@Kayumiy](https://mapwindow.discourse.group/u/Kayumiy)\
**Post date:** [May 29, 2020, 6:46am UTC](https://mapwindow.discourse.group/t/toolstripstatuslabel-label/600/3 "2020-05-29T06:46:41Z")

</div>

It shows this error when I run the program…

```
Unhandled Exception: System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
```

---

<div class="post-metadata">

**Author:** ![jerryfaust](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/jerryfaust/32/378_2.png) [@jerryfaust](https://mapwindow.discourse.group/u/jerryfaust)\
**Post date:** [May 29, 2020, 7:27am UTC](https://mapwindow.discourse.group/t/toolstripstatuslabel-label/600/4 "2020-05-29T07:27:35Z")

</div>

We will need more information, like seeing the code and the line number that had the error.

Thanks.

---

<div class="post-metadata">

**Author:** ![Kayumiy](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/kayumiy/32/233_2.png) [@Kayumiy](https://mapwindow.discourse.group/u/Kayumiy)\
**Post date:** [May 29, 2020, 7:55am UTC](https://mapwindow.discourse.group/t/toolstripstatuslabel-label/600/5 "2020-05-29T07:55:48Z")

</div>

```
 private void Form1_Load(object sender, EventArgs e)
        {
            ShowAttributes(axMap1, @"C:\Users\User\Downloads\CH_00_D002_20200512\CH_00_D002_20200512.shp");

         
        }

        // <summary>
        // Shows attributes of shape in mouse move event.
        // </summary>
        public void ShowAttributes(AxMap axMap1, string dataPath)
        {
            //axMap1.Projection = tkMapProjection.PROJECTION_GOOGLE_MERCATOR;
            string filename = dataPath;
            Shapefile sf = new Shapefile();
            if (sf.Open(filename))
            {
                m_layerHandle = axMap1.AddLayer(sf, true);
                sf = axMap1.get_Shapefile(m_layerHandle); // in case a copy of shapefile was created by GlobalSettings.ReprojectLayersOnAdding

                axMap1.SendMouseMove = true;
                axMap1.CursorMode = tkCursorMode.cmIdentify;
                axMap1.ShapeHighlighted += AxMap1ShapeHighlighted;
                //m_label = label;
            }
            else
            {
                MessageBox.Show("Failed to open shapefile");
            }
        }

// <summary>
        // Handles ShapeHighlighted event and shows attributes of the selected shape in the label
        // </summary>
        public void AxMap1ShapeHighlighted(object sender, _DMapEvents_ShapeHighlightedEvent e)
        {
            Shapefile sf = axMap1.get_Shapefile(e.layerHandle);
            if (sf != null)
            {
                string s = "";
                for (int i = 0; i < sf.NumFields; i++)
                {
                    string val = sf.get_CellValue(i, e.shapeIndex).ToString();
                    if (val == "") val = "null";
                    s += sf.Table.Field[i].Name + ":" + val + "; ";
                }
                //m_label.Text = s;
                Console.WriteLine(s);

            }
        }
```

---

<div class="post-metadata">

**Author:** ![Kayumiy](https://yyz2.discourse-cdn.com/free1/user_avatar/mapwindow.discourse.group/kayumiy/32/233_2.png) [@Kayumiy](https://mapwindow.discourse.group/u/Kayumiy)\
**Post date:** [May 29, 2020, 7:57am UTC](https://mapwindow.discourse.group/t/toolstripstatuslabel-label/600/6 "2020-05-29T07:57:11Z")

</div>

![image](https://global.discourse-cdn.com/free1/uploads/mapwindow1/original/1X/803abe39080d5bf648295a97adacb6d3fc3c1dbd.png)

When I press the mouse left button o the map, it shows this error above:

---

<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:** [January 5, 2022, 3:09pm UTC](https://mapwindow.discourse.group/t/toolstripstatuslabel-label/600/7 "2022-01-05T15:09:04Z")

</div>


