By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,290 Members | 1,464 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,290 IT Pros & Developers. It's quick & easy.

Trouble using the Collection Object

P: n/a
I am trying to add items to a collection object in VB and keep getting
the error:

"You must implement the Add(System.Object) method on
Microsoft.VisualBasic.Collection because it inherits from ICollection"

Here is my code that is attempting to add items to the collection,
which to me looks like I am using the Add method. Any ideas??

################################################## ###############

Dim myOrderItems As New Collection
Dim myOrderItemsData As DataSet
Dim myDataRow As DataRow

myOrderItemsData = GetOrderItems(OrderID)

For Each myDataRow In myOrderItemsData.Tables(0).Rows
Dim myOrderItem As New OrderItemClass
myOrderItem.RowID = myDataRow.Item("rowID")
myOrderItems.Add(myOrderItem, myOrderItem.RowID)
myOrderItem = Nothing
Next

################################################## ###############
Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Which version of VB ?

On 26 Sep 2003 10:47:29 -0700, sp*******@yahoo.com (Rick Clift) wrote:
I am trying to add items to a collection object in VB and keep getting
the error:

"You must implement the Add(System.Object) method on
Microsoft.VisualBasic.Collection because it inherits from ICollection"

Here is my code that is attempting to add items to the collection,
which to me looks like I am using the Add method. Any ideas??

################################################# ################

Dim myOrderItems As New Collection
Dim myOrderItemsData As DataSet
Dim myDataRow As DataRow

myOrderItemsData = GetOrderItems(OrderID)

For Each myDataRow In myOrderItemsData.Tables(0).Rows
Dim myOrderItem As New OrderItemClass
myOrderItem.RowID = myDataRow.Item("rowID")
myOrderItems.Add(myOrderItem, myOrderItem.RowID)
myOrderItem = Nothing
Next

################################################# ################


Jul 17 '05 #2

P: n/a
I am using VB.NET with Visual Studio .NET 2003. If it makes any
difference, I am trying to create a collection of objects and send
them across a web service. I'm not sure that that matters in this
case, but thought I'd give all the information I have.

Rick
er*****@nowhere.com (J French) wrote in message news:<3f***************@news.btclick.com>...
Which version of VB ?

Jul 17 '05 #3

P: n/a
On 29 Sep 2003 11:19:07 -0700, sp*******@yahoo.com (Rick Clift) wrote:
I am using VB.NET with Visual Studio .NET 2003. If it makes any
difference, I am trying to create a collection of objects and send
them across a web service. I'm not sure that that matters in this
case, but thought I'd give all the information I have.


It does make a difference

Most people here are using VB5 or VB6

You need a dotnet NG
Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.