locked
BaseConrolArray is not compactible with .net 4, so please suggest how to come out of the issue RRS feed

  • Question

  • Hi,

    Base ControlArray is not compatible with the .net, so how can we solve the issue:

    Below is my code :

    <ProvideProperty("Index", GetType(RectangleShape))> Friend Class RectangleShapeArray
        Inherits BaseControlArray
        Implements IExtenderProvider

        Public Event [Click] As System.EventHandler

        Public Sub New()
            MyBase.New()
        End Sub

        Public Sub New(ByVal Container As IContainer)
            MyBase.New(Container)
        End Sub

        Public Function CanExtend(ByVal Target As Object) As Boolean Implements IExtenderProvider.CanExtend
            If TypeOf Target Is RectangleShape Then
                Return BaseCanExtend(Target)
            End If
        End Function

        Public Function GetIndex(ByVal o As RectangleShape) As Short
            Return BaseGetIndex(o)
        End Function

        Public Sub SetIndex(ByVal o As RectangleShape, ByVal Index As Short)
            BaseSetIndex(o, Index)
        End Sub

        Public Function ShouldSerializeIndex(ByVal o As RectangleShape) As Boolean
            Return BaseShouldSerializeIndex(o)
        End Function

        Public Sub ResetIndex(ByVal o As RectangleShape)
            BaseResetIndex(o)
        End Sub

        Public Shadows Sub Load(ByVal Index As Short)
            MyBase.Load(Index)
            CType(Item(0).Parent, ShapeContainer).Shapes.Add(Item(Index))
        End Sub

        Public Shadows Sub Unload(ByVal Index As Short)
            CType(Item(0).Parent, ShapeContainer).Shapes.Remove(Item(Index))
            MyBase.Unload(Index)
        End Sub

        Default Public ReadOnly Property Item(ByVal Index As Short) As RectangleShape
            Get
                Item = CType(BaseGetItem(Index), RectangleShape)
            End Get
        End Property

        Protected Overrides Sub HookUpControlEvents(ByVal o As Object)

            Dim ctl As RectangleShape
            ctl = CType(o, RectangleShape)

            If Not IsNothing(ClickEvent) Then
                AddHandler <g class="gr_ gr_199 gr-alert gr_spell gr_inline_cards gr_run_anim ContextualSpelling" data-gr-id="199" id="199">ctl</g>.Click, ClickEvent
            End If

        End Sub

        Protected Overrides Function GetControlInstanceType() As System.Type
            Return GetType(RectangleShape)
        End Function

    End Class

    Tuesday, April 17, 2018 6:18 AM

All replies

  • Hi friend,

    This forum is for Visual Studio IDE issue, as your question is more related to VB.NET developing, I will move it to VB forum for you to get a quick answer.

    Thanks for your understanding.

     

    Regards,  

    Fletcher


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, April 18, 2018 6:27 AM
  • Base ControlArray is not compatible with the .net, so how can we solve the issue:

    You will generally find that using the code converter for converting code from VB6 is more trouble than it's worth, as you will eventually do a lot of rewriting.  You should get rid of the RectangleShapeArray class and replace it with a List(Of RectangleShape).  The usage will be almost identical, except for the initialisation. How you re-code that depends on how the shapes are being created.  If they exist at design time then you can use .Add and add them to the list by name in the form load event.  If you are creating them at run time then add them to the list as you create them.

    Wednesday, April 18, 2018 8:36 AM
  • Marty,

    That class was made temporally for VB7 to VB10 in the compatibleVB6 namespace. 

    However, many here have never seen VB6. Therefore you limit those who can help you. It is as asking my two stroke engine stops. 

    Tell what you want to acclaim, there are many here active who know exact how to do shapes in current VB (or better say using the current framework).

    Be aware, it was never in the VB language. It was likewise .Net something which could be used with VB. 


    Success
    Cor

    Wednesday, April 18, 2018 10:36 AM