473,378 Members | 1,134 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,378 software developers and data experts.

Trouble using the Collection Object

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
3 4150
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Penn Markham | last post by:
Hello all, I am writing a script where I need to use the system() function to call htpasswd. I can do this just fine on the command line...works great (see attached file, test.php). When my...
3
by: JayBrahms | last post by:
Hi there. OK, this is a little bit complicated. I would live to find a different way to do this, but evidentially I am not able to open a Text-File in JAVASCRIPT and fill an Array with the...
0
by: JackWarner | last post by:
OK, I'm finally getting our organization to upgrade from v6, and the first project I try to recompile I run into hairy problems. We've used this ATL COM collection class for years. It looks like...
0
by: Elliot M. Rodriguez | last post by:
I implemented a very small, basic data access layer for my web application. It works just fine, except for this one bug. One of my methods returns an abstracted dataset. To accomodate X number of...
6
by: Scott M. Lyon | last post by:
As I mentioned in my other post, I'm attempting to, using COM Interop so I can update existing VB6 code to (for several specific functions) return a Hashtable from a .NET library. I've had...
3
by: RSH | last post by:
I am slowly getting the hang of objects and creating my own. I was given some help in assigning an object to a ComboBox collection. I have been looking at it and I get the concept which is very...
1
by: viktor9990 | last post by:
I'm trying to bind a custom collection to an autogenerated datagrid without success. I'm getting this error: DataGrid with id 'DataGrid2' could not automatically generate any columns from the...
10
by: Hendri Adriaens | last post by:
Hi, I'm trying to automate the creation of an excel file via COM. I copied my code below. I read many articles about how to release the COM objects that I create. The code below runs just fine...
5
matheussousuke
by: matheussousuke | last post by:
Hello, I'm using tiny MCE plugin on my oscommerce and it is inserting my website URL when I use insert image function in the emails. The goal is: Make it send the email with the URL...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.