# VB6 SP6 & OCX 5.1.1, get handle?

**URL:** <https://mapwindow.discourse.group/t/vb6-sp6-ocx-5-1-1-get-handle/581>\
**Category:** MapWinGIS\
**Created:** [May 24, 2020, 12:03pm UTC](https://mapwindow.discourse.group/t/vb6-sp6-ocx-5-1-1-get-handle/581 "2020-05-24T12:03:27Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bob](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@Bob](https://mapwindow.discourse.group/u/Bob)\
**Post date:** [May 24, 2020, 12:03pm UTC](https://mapwindow.discourse.group/t/vb6-sp6-ocx-5-1-1-get-handle/581/1 "2020-05-24T12:03:27Z")

</div>

Hello,  
Since I went to VB6 (to an old huge project), I could not find a way to get shapefile and layer handles:

layerHandle = axMap1.get\_LayerHandle  
sf = axMap1.get\_Shapefile

I need to select some point shapes around the point shape located in the center of the screen, but all examples found on MapWinGIS website are using those methods…

Those two methods are NOT available. Is there a way around ?  
Thanks,

---

<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 24, 2020, 4:40pm UTC](https://mapwindow.discourse.group/t/vb6-sp6-ocx-5-1-1-get-handle/581/2 "2020-05-24T16:40:34Z")

</div>

Hello @Bob

In VB6, the methods are exposed without the “get\_” prefix. Also, for objects like the Shapefile, you need to use the `Set` method.

It should be

```
layerHandle = axMap1.LayerHandle(i) ' where i is the layer position 
Set sf = axMap1.Shapefile(layerHandle) ' and you need to specify which layer

```

Regards,  
Jerry.

---

<div class="post-metadata">

**Author:** ![Bob](https://avatars.discourse-cdn.com/v4/letter/b/ea666f/32.png) [@Bob](https://mapwindow.discourse.group/u/Bob)\
**Post date:** [May 24, 2020, 6:44pm UTC](https://mapwindow.discourse.group/t/vb6-sp6-ocx-5-1-1-get-handle/581/3 "2020-05-24T18:44:11Z")

</div>

Thank you Jerry !  
It solved the same issue I had with labels.

---

<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/vb6-sp6-ocx-5-1-1-get-handle/581/4 "2022-01-05T15:09:03Z")

</div>


