Base Collection

Posted on 2006-05-30
Last Modified: 2006-11-18
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
    End Sub

Any idea ? Anything missing ? Do I need to "link" the collection via a specific attribute from my collector ?
Question by:TheSonics
    LVL 96

    Accepted Solution

    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
          Return CType(MyBase.List.Item(index), MenuItem)
        End Get
      End Property

    End Class


    Author Comment

    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 :).


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    Suggested Solutions

    This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
    A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
    how to add IIS SMTP to handle application/Scanner relays into office 365.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now