473,480 Members | 1,789 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How do you Pass an array of Objects from C# to VB6 (interop)

I am wondering if there is a way (maybe via Marshalling ) to pass an
array
of Objects of some C# defined class to VB. I am already launching a C#
form
from VB with simple call backs using a basic interface. Now what I need
is nice way to pass back an array of a certain type of class.

//Some C# class
public class SomeClass{
// various parameters (strings and ints)

}

//Code that would pass an array of the above class to the VB app....
SomeClass[] arraySomeClasses = getSomeClasses();
? passArrayToVB(arraySomeClasses);

Not really sure where to start with this one.

Many thanks and good karma in return !

Nov 17 '05 #1
1 2309
There shouldn't be much of a problem. You just make sure that in VB you
declare the function as you would normally which takes an array.

The only thing that I think you might have to do is use ref in the C#
call, since VB only allows you to declare arrays as passed by ref.

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

<Wi**********@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
I am wondering if there is a way (maybe via Marshalling ) to pass an
array
of Objects of some C# defined class to VB. I am already launching a C#
form
from VB with simple call backs using a basic interface. Now what I need
is nice way to pass back an array of a certain type of class.

//Some C# class
public class SomeClass{
// various parameters (strings and ints)

}

//Code that would pass an array of the above class to the VB app....
SomeClass[] arraySomeClasses = getSomeClasses();
? passArrayToVB(arraySomeClasses);

Not really sure where to start with this one.

Many thanks and good karma in return !

Nov 17 '05 #2

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

Similar topics

2
2306
by: Interop newbie | last post by:
Hello, The following code makes an interop call to a Com object from C#: //Create a Bom object NewsBusObjsRCW.NewsBomObjClass myNewsBom = new NewsBusObjsRCW.NewsBomObjClass();
16
14068
by: Ekim | last post by:
hello, I'm allocating a byte-Array in C# with byte byteArray = new byte; Now I want to pass this byte-Array to a managed C++-function by reference, so that I'm able to change the content of the...
6
1706
by: Boni | last post by:
Dear all, I have written a C++ COM object: STDMETHOD(myfunc)(INT* array) Now I need to pass an array from c# to COM. I generated a COM interop and the signature of the function is ...
3
1273
by: weird0 | last post by:
i am trying to add nodes to a node dynamically ... and assign its proerties to a node objects stored inside the array.... when the ShapeAdded event is fired... ...inside the if block... ...
0
6908
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
7048
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
7088
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...
1
6741
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...
0
5342
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,...
1
4783
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...
0
1300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
183
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.