Use Option Strict On ?

Jan 31, 2014 at 9:17 AM
Hi,

I'm used to add option Strict on to my VB.nat code to avoid many mistakes. I can't do that with mapwingis which often uses "object". This causes late binding error with this option on.

As an example in
Dim shapes As New Object

.SelectShapes(ext, 0.0, MapWinGIS.SelectMode.INTERSECTION, shapes)
 .ShapeSelected(shapes(0)) = True ' late binding error

 .ShapeSelected(cint(shapes(0))) ' will generate the same error 
I would appreciate if someone gives me a trick to avoid it.

I think it would be good also if Mapwingis uses less this object type, it seems to me that it was possible to return here an array of integer .

Thanks,

Olivier
Feb 1, 2014 at 12:51 PM
once again I answer to myself
        Dim oshapes As Object
        Dim shapes() As Integer

            If .SelectShapes(ext, 0.0, MapWinGIS.SelectMode.INTERSECTION, oshapes) Then
                shapes = CType(oshapes, Integer())
and uses shapes(x)
Coordinator
Feb 3, 2014 at 6:34 PM
Hi Olivier,

I'm glad you solved your own problems ;)

Objects are used because they come from the C++ COM Object.
As you already figured out you need to cast them to the type you need.

Paul