473,394 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Two Classes one for Individual Item Another for a Collection of Items

I am writing a class library. One class is Package and is basically
just the fields for the Package object. Another class is Packages and
is basically used to manage a collection of Package objects.

Could someone point me to some complete example code for this kind of
scenario?

Thanks
Nov 21 '05 #1
1 800
"slonocode" <oh******@spamsux.sux> wrote in message
news:32*************@individual.net...
I am writing a class library. One class is Package and is basically just
the fields for the Package object. Another class is Packages and is
basically used to manage a collection of Package objects.

Could someone point me to some complete example code for this kind of
scenario?

Thanks


Public Class Package_Collection

Inherits CollectionBase

Default Public Property Item(ByVal index As Integer) As Package

Get

Return CType(List(index), Package)

End Get

Set(ByVal Value As Package)

List(index) = Value

End Set

End Property

Public Function Add(ByVal value As Package) As Integer

Return List.Add(value)

End Function 'Add

Public Function IndexOf(ByVal value As Package) As Integer

Return List.IndexOf(value)

End Function 'IndexOf

Public Sub Insert(ByVal index As Integer, ByVal value As Package)

List.Insert(index, value)

End Sub 'Insert

Public Sub Remove(ByVal value As Package)

List.Remove(value)

End Sub 'Remove

Public Function Contains(ByVal value As Package) As Boolean

' If value is not of type Package, this will return false.

Return List.Contains(value)

End Function 'Contains

End Class
Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Walter Zydhek | last post by:
I am having a problem using the NameValueCollection type. If I remove one of the items while iterating through an collection of this type, I end up with an exception. This exception is:...
4
by: Colleyville Alan | last post by:
I am trying to use a list box to allow users to select items, the results are queried based on the selection and written to a spreadsheet. If the item already exists on their current spreadsheet,...
9
by: Gerald Lightsey | last post by:
I am doing some work that involves automating MS MapPoint 2002. The object model is documented in the context of Visual Basic 6.0. A typical example follows. 'Output first result of find...
2
by: Ash Jones | last post by:
I trying to do nested items in a collection. I've got an item which one of the properties is subitems, which is a collection of item. can do the root level but if i do a subitem at design time i...
0
by: Larry | last post by:
Although there are font attribute properties for the items in a ListView component, the complier tells me that they are read-only. Is there any way to get access and change the font poperties of...
9
by: me | last post by:
Hi All, I am new to Classes and learniing the ropes with VB.NET express Here's my question - say I have a want to manage a list of books. Each book has an Author, Title and ISBN Now, I am...
9
by: zacks | last post by:
I have written a serialized class that has several properties that are typed as a list of type class. When I deserialize an XML file, the list is populated just fine. But I am having trouble...
1
by: SP | last post by:
I have created an abstract class inheriting from KeyedCollection<long, TItemto use as a base class for my collections. In some derived classes I am providing a new indexer property for the key...
2
by: Vaughn Haybittle | last post by:
Hi, I have a few questions relating to web services. First some Background: I have developed two classes in ASP.Net (VB): 1) The first is a class that contains some fields that represent...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.