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

Another try.... What to use to pass data from VB dll to C#?

P: n/a
Hello,

I tried this question prior and got no response, so thought I would try
to explain differently..

I am not sure which type of object to pass between a VB 6.0 ActiveX dll and
C#. I am wrapping a COM object because I am having issues with the types
that C# does not seem to understand. I need to be able to use a method from
the VB 6.0 dll which will query a proprietary data structure. I then need
to return this and iterate through it in C#. I would prefer some type of
recordset object, but am not sure what needs to be done. I would think this
would be simple, but not sure...

Any idea how I can either: 1. Pass a recordset object -OR- 2. Pass
an array -OR- 3. Pass some other object which makes sense

The VB dll should: Be able to take parameters and return a set of
data (Date/Time and Value(single/double/string - or I can force it to string
and convert)

The C# app should: Be able to iterate through the returned object and
evaluate the information.

Thanks in advance,

Andrew Mueller
Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Andrew,

This is really all up to you. You can export .NET types to COM, and
they should be accessible to VB (if the types you are creating/using are
Automation compatable). Subsequently, you can import COM types into .NET.

This means that you could have the VB dll use a DataSet or use an
ADODB.Recordset, it's really up to you. You just have to make sure that it
interops well. It's probably easiest to have the VB6 dll work with
recordset objects. However, if you want to take advantage of ADO.NET, you
will have to perform conversions between ADO.NET data sets and
ADODB.Recordsets.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

"Andrew Mueller" <am******@ins3.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hello,

I tried this question prior and got no response, so thought I would try to explain differently..

I am not sure which type of object to pass between a VB 6.0 ActiveX dll and C#. I am wrapping a COM object because I am having issues with the types
that C# does not seem to understand. I need to be able to use a method from the VB 6.0 dll which will query a proprietary data structure. I then need
to return this and iterate through it in C#. I would prefer some type of
recordset object, but am not sure what needs to be done. I would think this would be simple, but not sure...

Any idea how I can either: 1. Pass a recordset object -OR- 2. Pass an array -OR- 3. Pass some other object which makes sense

The VB dll should: Be able to take parameters and return a set of
data (Date/Time and Value(single/double/string - or I can force it to string and convert)

The C# app should: Be able to iterate through the returned object and evaluate the information.

Thanks in advance,

Andrew Mueller

Nov 13 '05 #2

P: n/a
What ever "object" you pass, you have to have a reference to a .NET wrapped
version of that object. My personal feeling is passing the data as XML is
your best option. If you do this right (ie, follow the DataSet schema), you
can move data from COM into a .NET DataSet.

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
Author: ADO.NET and XML: ASP.NET on the Edge

************************************************** **************************
****
Think Outside the Box!
************************************************** **************************
****
"Andrew Mueller" <am******@ins3.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hello,

I tried this question prior and got no response, so thought I would try to explain differently..

I am not sure which type of object to pass between a VB 6.0 ActiveX dll and C#. I am wrapping a COM object because I am having issues with the types
that C# does not seem to understand. I need to be able to use a method from the VB 6.0 dll which will query a proprietary data structure. I then need
to return this and iterate through it in C#. I would prefer some type of
recordset object, but am not sure what needs to be done. I would think this would be simple, but not sure...

Any idea how I can either: 1. Pass a recordset object -OR- 2. Pass an array -OR- 3. Pass some other object which makes sense

The VB dll should: Be able to take parameters and return a set of
data (Date/Time and Value(single/double/string - or I can force it to string and convert)

The C# app should: Be able to iterate through the returned object and evaluate the information.

Thanks in advance,

Andrew Mueller

Nov 13 '05 #3

P: n/a
What type of data? Is it the type of data that will break down nicely
to a primitive type like a byte array or int array? You can pass
strings easily enough, so if you can serialize or string-represent
your objects, that's a consideration. You can use ADO recordsets in
..NET so passing a disconnected ADO recordset is an option.

"Andrew Mueller" <am******@ins3.com> wrote in message news:<#z**************@TK2MSFTNGP12.phx.gbl>...
Hello,

I tried this question prior and got no response, so thought I would try
to explain differently..

I am not sure which type of object to pass between a VB 6.0 ActiveX dll and
C#. I am wrapping a COM object because I am having issues with the types
that C# does not seem to understand. I need to be able to use a method from
the VB 6.0 dll which will query a proprietary data structure. I then need
to return this and iterate through it in C#. I would prefer some type of
recordset object, but am not sure what needs to be done. I would think this
would be simple, but not sure...

Any idea how I can either: 1. Pass a recordset object -OR- 2. Pass
an array -OR- 3. Pass some other object which makes sense

The VB dll should: Be able to take parameters and return a set of
data (Date/Time and Value(single/double/string - or I can force it to string
and convert)

The C# app should: Be able to iterate through the returned object and
evaluate the information.

Thanks in advance,

Andrew Mueller

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.