473,411 Members | 2,230 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,411 software developers and data experts.

VB6 .NET Interop - Passing Array of Objects or Object Collection

Hi,

I have tried several things to passing an array of objects or a Object
Collection from .NET to VB6 but I can't get it work. Passing one object
works fine, but more than one not. Has anybody a solution for that.

Apr 12 '07 #1
2 6707
Torsten,

Can you show some of the attempts you are trying to make? You will need
to show the method you are exporting to COM (as well as any attributes for
interop) and then you will have to show the call site as well.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Torsten Z" <A@B.COMwrote in message
news:OP**************@TK2MSFTNGP04.phx.gbl...
Hi,

I have tried several things to passing an array of objects or a Object
Collection from .NET to VB6 but I can't get it work. Passing one object
works fine, but more than one not. Has anybody a solution for that.

Apr 12 '07 #2
First of all: I have just found a solution with using a .NET-Collection
instead of an array. I make the datatype of the collection available in VB
and work with this.

But here is the original try:

This is the Part of the the .Net Interop Class
....
public User GetUser()
{
Service1 s1 = new Service1();
User u = s1.GetUser("g");
return u;
}

public User[] GetUsers()
{
Service1 s1 = new Service1();
User[] us = s1.GetUsers("g");
return us;
}
.....

VB procedure:
Private Sub Befehl0_Click()
Dim wss As WsSample
Dim u As User
Dim us() As User

On Error GoTo Err_Proc
Set wss = New WsSample

'get User Objekt
Set u = wss.GetUser 'works fine
Debug.Print u.Name, u.Id

'get ArrayOfUsers
us = wss.GetUsers 'does not work
Exit_Proc:
Exit Sub
Err_Proc:
Debug.Print Err.Number, Err.Description
GoTo Exit_Proc
End Sub

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comschrieb
im Newsbeitrag news:%2****************@TK2MSFTNGP02.phx.gbl...
Torsten,

Can you show some of the attempts you are trying to make? You will
need
to show the method you are exporting to COM (as well as any attributes for
interop) and then you will have to show the call site as well.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Torsten Z" <A@B.COMwrote in message
news:OP**************@TK2MSFTNGP04.phx.gbl...
Hi,

I have tried several things to passing an array of objects or a Object
Collection from .NET to VB6 but I can't get it work. Passing one object
works fine, but more than one not. Has anybody a solution for that.



Apr 12 '07 #3

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

Similar topics

1
by: JC | last post by:
How does garbage collection work in C# and VB.NET for data returned from COM object? For example, a COM object written in C++ returns a SAFEARRAY to C# or VB.NET, will this SAFEARRAY (mapped to...
3
by: domeceo | last post by:
can anyone tell me why I cannot pass values in a setTimeout function whenever I use this function it says "menu is undefined" after th alert. function imgOff(menu, num) { if (document.images) {...
3
by: SV | last post by:
Dear all, In my application I have a lot of hidden fields. I want to make them invisible for the users though for debugging reasons I want to make them visible. So I want to add these objects to...
1
by: Nadav | last post by:
Hi, Introduction *************** I have a system build of a collection of 'Native COM objects' and '.NET COM interop' objects, all of the COM objects are managed through a 'Native COM' layer,...
1
by: vbvjain | last post by:
I am developing an applocation which reads mails in outlook inbo alongwith attachments and all these informmation is stored in collection which i need to pass it to a web service, which will perfor...
11
by: John Pass | last post by:
Hi, In the attached example, I do understand that the references are not changed if an array is passed by Val. What I do not understand is the result of line 99 (If one can find this by line...
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...
7
by: heddy | last post by:
I have an array of objects. When I use Array.Resize<T>(ref Object,int Newsize); and the newsize is smaller then what the array was previously, are the resources allocated to the objects that are...
9
by: Greger | last post by:
Hi, I am building an architecture that passes my custom objects to and from webservices. (Our internal architecture requires me to use webservices to any suggestion to use other remoting...
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
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.