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

How to pass an array to .NET assembly from VBScript?

Hi,

I've writen a class library in C# and intend to use it from an ASP page. It's not the first time I do it, so I already know the drill. This time however I'm trying to pass a two dimensional array of strings which I've never done before. I've tryed all sorts of types: string[,], object[,], object, Array. None of them work.

Here is a sample code:

Dim strArray(2, 2)
strArray(0,0) = "col1"
strArray(0,1) = "val1"
strArray(1,0) = "col2"
strArray(1,1) = "val2"
Dim myObj
Set myObj = Server.CreateObject("MyObject")
Call myObj.Log(strArray)
Set myObj = Nothing

Thanks in advance,
Gustavo
Jun 27 '08 #1
1 2083
Gustavo Monteiro wrote:
I've writen a class library in C# and intend to use it from an ASP page. It's not the first time I do it, so I already know the drill. This time however I'm trying to pass a two dimensional array of strings which I've never done before. I've tryed all sorts of types: string[,], object[,], object, Array. None of them work.
Did you use MarshalAs explicitly? In other words, have you tried this?

public interface IMyObj {
void Log([MarshalAs(UnmanagedType.SafeArray, SafeArraySubType =
VarEnum.VT_VARIANT), In] int[,] x);
}

Or this:

void Log([MarshalAs(UnmanagedType.SafeArray, In] Array x);

(I can't try it myself.)

--
J.
http://symbolsprose.blogspot.com
Jun 27 '08 #2

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

Similar topics

6
by: Gram | last post by:
Hello, Can anyone tell me if ASP can pass an Array intp a Function? If so, can anyone point me to an example? Thanks in advance. Gram.
2
by: Augusto Cesar | last post by:
Hello people. How can I Pass ASP Array variable to Javascript; I´m to trying this: <script language="JavaScript"> var x = new Array(10);
0
by: sebascomeau | last post by:
Hi everyone, Hello my name is Sebastien and I need some help. He have one week past and I search to do one thing but I can't. If someone help me, I'll be so happy :). My problem is I want to...
2
by: Edvin | last post by:
Greetings, I'm trying to access C# COM object from a VBscript, where C# will modify the reference parameter to an array. I found simple reference parameter datatypes (i.e. int, string) yield...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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?
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...

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.