My Class in CustomWebRectangle -Type "Iterable" has no member named "AddControlToItem"

I created a class “ObjectsOnRectangle”. I added an Integer array and the “AddNumber(number As Integer)” method.
Everything works fine on WebPage (Button1.Pressed), but I can’t do it in CustomWebRectangle.Opening

Sub Opening() Handles Opening
  Me.Objects = New ObjectsOnRectangle
  
  For Each c As WebControl In Me.Controls
    Me.Objects.AddNumber(1) 'Type "Iterable" has no member named "AddNumber" Me.Objects.AddNumber(1)
  Next
End Sub

How to do it?

I’ve attached a simple example. Please help
ClassOfControls

The name Objects is a function of the framework that you won’t be able to override. Name the property just about anything else and your code will work.

3 Likes

Hi Artur,

You just have to rename the property CustomWebRectangle.Objects because Objects is an existing property of WebRectangle, see the doc.
Rename Objects property to e.g. Objs and update your code accordingly.

Regards,

Olivier
EDIT: @Tim_Parnell types faster than me :wink:

2 Likes

I was aware of such a mistake, so not “Add” but “AddNumber”, but I was not careful enough
Thank you @Tim_Parnell and @Olivier_Colard for your quick help :slight_smile: