473,399 Members | 3,106 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,399 software developers and data experts.

Traversing VBA.Collection

Hi,

I am using an OCX from VB6 that has a routine that outputs a collection.

If "Params" is defined as a collection in VB6,
The following statements (in the VB6 debug window) works:
?Params.Item(8).Value
VB outputs: &HFFFFFF (or whatever)

If am writing C# and I use the OCX that returns this collection,
I use the following definitions:
VBA.Collection commandParams;
commandParams = CommGenX1.getParamCollection();

How can I imitate the command ?Params.Item(8).Value ?
Or at least traverse the collection and print out the values.
I think some are numbers and some are strings...
Many thanks,

Josh
Nov 15 '05 #1
1 3528
Josh,

To traverse the collection, you could use a foreach (I believe that
because the collection implements IEnumVariant, this is supported).
However, you can also call the Item function. If you import the VB runtime
library for the Collection definition, then you have to pass the index as a
ref, like so:

// The index.
object pobjIndex = 1;

// Get the item.
object pobjItem = pobjCollection.Item(ref pobjIndex);

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Josh" <ho******@yahoo.com> wrote in message
news:d0**************************@posting.google.c om...
Hi,

I am using an OCX from VB6 that has a routine that outputs a collection.

If "Params" is defined as a collection in VB6,
The following statements (in the VB6 debug window) works:
?Params.Item(8).Value
VB outputs: &HFFFFFF (or whatever)

If am writing C# and I use the OCX that returns this collection,
I use the following definitions:
VBA.Collection commandParams;
commandParams = CommGenX1.getParamCollection();

How can I imitate the command ?Params.Item(8).Value ?
Or at least traverse the collection and print out the values.
I think some are numbers and some are strings...
Many thanks,

Josh

Nov 15 '05 #2

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

Similar topics

1
by: w.p. | last post by:
Hello! I want change default tab traversing in my app. But i don't know how to do it :( Belowe i include simple example - i want change default tab order: radiobutton "mode11" -> radiobutton...
2
by: Jim Cobban | last post by:
I am using Xerces to read an XML file and load it into a DOM so I can update it and subsequently serialize the updated DOM. The problem I have is that as I traverse the DOM I would like to inform...
3
by: Plamen Valtchev | last post by:
This is my problem: From JavaScript I want to find the list of all defined/loaded JavaScript functions/objects/names within the current scope (html page in a browser). the page could contain...
4
by: nmosafi | last post by:
I have a datagrid that I am binding to a custom collection, and I am having problems with data binding in an ASP.NET datagrid (1.1 framework). As a simple example, imagine a class called...
4
by: elziko | last post by:
I have a class ("ClassB") that inherits from 'ClassA' which inherist from UserControl. I then put ClassB onto a form. Is it then possible to tracerse all the controls on the form that inherit...
4
by: plmanikandan | last post by:
Hi, I am new to link list programming.I need to traverse from the end of link list.Is there any way to find the end of link list without traversing from start(i.e traversing from first to find the...
3
by: James | last post by:
Hi. I have created several Collection objects which inherit from System.Collections.CollectionBase but up until now I've been able to process them according to the order I populate them...
30
by: asit | last post by:
We kno that data can be pushed onto the stack or popped 4m it. Can stack be traversed ??
1
by: somcool | last post by:
I am facing an error while traversing a query in MS Access Details - When I click a button, a form which has the query opens up. There are certain fields which are in the form of combo box in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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.