
How .Items(5) + .Items.Item(5) ?
Allan,
In addition to what Luis Angel stated.
A field
Quote:
> Public Items As Collection
cannot have the same name as a property
Quote:
> Public Property Items(ByVal Index As Integer)
I would make the field private and name is m_items. The m_ identifies it as
a member field.
Then on your Property use the Default keyword, as Luis stated, which allows
you to omit the property name.
Also, you don't show that you ever create the m_items collection. I would
add a constructor to MyDataClass that creates the collection. Also making
m_items readonly ensures that the collection itself is never replaced (the
objects within the collection can be replaced...
Public Class myDataClass
Private ReadOnly m_items As Collection
Public Sub New()
m_Items = New Collection()
End Sub
Public Property Items(ByVal Index As Integer)
Get
End Get
Set(ByVal Value)
End Set
End Property
End Class
Hope this helps
Jay
Quote:
> How can I do the below :-
> Sub Test
> Dim Items = New myDataClass()
> Items.Item(5) = "testing
> Items(5) = "testing"
> End Sub
> Something like :-
> mItem = ListView1.Items(1)
> mItem = ListView1.Items.Item(0)
> The below keeps giving error that "Items" conflicts even before
compilation.
> Public Class myDataClass
> Public Items As Collection
> Public Property Items(ByVal Index As Integer)
> Get
> End Get
> Set(ByVal Value)
> End Set
> End Property
> End Class