Greater New Orleans.NET User Group Greater New Orleans .NET User Group (GNONUG) "KNOW .NET"
      Programming    Blogs    Data    Tool    Visual Studio.NET    C#    Other    .NET Framework    .NET Components    ADO.NET    Utility

GNONUG
Mission
Events
Discuss
Resource
Support
Links
Training



Discussion

Author Thread: Creating an Object Collection class
jjmaggiore
Creating an Object Collection class
Posted: Thursday, September 30, 2004 6:08 AM (PST)

Please discuss the proper way to add an “index” (i.e. an Item method) to a collection class that is derived from CollectionBase.  That part of the below code doesn’t work; even though it is nearly copied from VS.Net Help.

Also, is List a property of CollectionBase, where List is an object type?
 
Thanks,
John Maggiore
 
Public Class Fluid
 
    Dim sName As String
 
    Property Name() As String
        Get
            Name = sName
        End Get
        Set(ByVal str As String)
            sName = str
        End Set
    End Property
 
      ‘Other stuff here.
 
End Class
 
 
Public Class FluidsCollection
    Inherits System.Collections.CollectionBase
 
    Sub Add(ByVal f As Fluid)
        list.Add(f)
    End Sub
 
    Sub Remove(ByVal f As Fluid)
        Dim idx As Long
        idx = list.IndexOf(f)
        list.RemoveAt(idx)
    End Sub
 
    Overrides Sub Clear()
        list.Clear()
    End Sub
 
    ReadOnly Property Item(ByVal idx As Integer) As Fluid
        Get
            Return CType(list.Item(idx), Fluid)  ‘ Not allowed???
        End Get
    End Property
 
End Class



New Orleans Personal Computer Club
"If God had wanted me otherwise, He would have created me otherwise." -- Johann Wolfgang von Goethe

 

New Events

  • July 2010 GNONUG Meeting
    Patrick LeBlanc
    Profiling Your DB
    Tuesday, July 13, 2010 6:30pm
    New Horizons New Orleans


  • July GNONUG Meeting
    Steve Andrews will be our guest presenter on Monday, July 13 from 6:30 pm - 9:00 pm. This event is open to anyone interested in .Net.

  • (Speaker Idol) June BRDNUG .Net User
    Sponsored by: Sparkhound

    SPEAKER IDOL Format
    1. 5 speakers.
    2. 15 minutes each.
    3. 3 Grueling judges (Billy Jacobs, Jon Dalberg, Mike Huguet)
    4. Audience will choose the winner.
    5. Great prizes!

    Agenda
    5:45 pm - 6:15 pm: General Introduction/Food and Drinks
    6:15 pm - 7:30 pm: The Competition Will Begin
    7:30 pm - until: Open forum for questions



  •  

    New Posts

  • SharePoint admin/developer
    Posted by md3 on Sunday, April 04, 2010 (PST)

  • Baton Rouge .NET positions
    Posted by md3 on Wednesday, June 24, 2009 (PST)

  • Access
    Posted by md3 on Wednesday, September 19, 2007 (PST)


  •  
    Greater New Orleans .NET User Group "KNOW .NET" GNONUG