• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 287
  • Last Modified:

Base Collection

I have Units Called ATPUnit with following properties :

    ReadOnly Property Unit() As Integer
    ReadOnly Property Prog() As Integer
    ReadOnly Property RLU() As Integer
    ReadOnly Property Heure() As Date
    ReadOnly Property Test() As Integer


I want to create an ATPUnitColl. So here we go

Public Interface intATPCollUnit

    Default ReadOnly Property Item(ByVal index As Integer) As MeasureUnit
    ReadOnly Property ItemAtTest(ByVal index As Integer) As Integer
    Sub Add(ByVal theATPUnit As ATPUnit)
    Sub Remove(ByVal MeasUnit As MeasureUnit)

End Interface


I have problem on runtime when i try to add an ATPUnit to my collection :

    Public Sub Add(ByVal theATPUnit As ATPUnit) Implements intATPCollUnit.Add
        List.Add(theATPUnit)
    End Sub


Any idea ? Anything missing ? Do I need to "link" the collection via a specific attribute from my collector ?
0
TheSonics
Asked:
TheSonics
1 Solution
 
Bob LearnedCommented:
1) .NET version?

2) Here is an example of a type-specific collection:

Public Class MenuItemCollection : Inherits CollectionBase

  Public Function Add(ByVal item As MenuItem) As Integer

    Return MyBase.List.Add(item)

  End Function

  ' Get an item by index.
  Default Public ReadOnly Property Item(ByVal index As Integer) As MenuItem
    Get
      Return CType(MyBase.List.Item(index), MenuItem)
    End Get
  End Property

End Class

Bob
0
 
TheSonicsAuthor Commented:
In fact I was waking up, i just started thinking about it and it seems to work so far.


By the way thank you man.
Here are some points for you :).



Ritch.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now