I have a com dll interface:
Public Function Hulian_Acount_all(ByVal vIndex As Variant, _
ByRef vDate As Variant, _
ByRef vCount As Variant, _
ByRef vMoney As Variant, _
ByRef vMyDetail As Variant, _
ByVal vTimeStamp As Variant, _
ByVal vSPID As Variant, _
ByVal vType As Variant, _
ByVal vResult As Variant, _
ByVal vSenderID As Variant, _
ByVal vYourCount As Variant, _
ByVal vYourMoney As Variant, _
ByVal vDetail_result As Variant, _
ByVal vSucess_count As Variant, _
ByVal vSucess_money As Variant, _
ByVal vFail_count As Variant, _
ByVal vFail_money As Variant, _
ByVal vYour_records As Variant)
I use it in C# like this:
obj.Hulian_Acount_all
(3,"","","","",TimeStamp,"","",Result,SenderID,Tot alCount,TotalFee,"","","",
"","","") ;
But the compiler shows out the error: "cannot convert the string to ref
object"
How can I pass the 2 ~ 5 ByRef parameters to the dll in C# ? Thanks a lot! 2 2799
pecker,
Because they are declared as variants, you have to store your values as
type object first, and then pass them by ref. You will have to do this:
// The values. <value> are the values you want to pass.
object vDate = <value>, vCount = <value>, vMoney = <value>, vMyDetail =
<value>;
// Call the method.
myObject.Hulian_Acount_all(vIndex, ref vDate, ref vCount, ref vMoney, ref
vMyDetail, vTimeStamp, vSPID, vType, vResult, vSenderID, vYourcount,
vYourMoney, vDetail_result, vSucess_count, vSucess_money, vFail_count,
vFail_money, vYour_records);
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"pecker" <pe********@sina.com> wrote in message
news:uz**************@TK2MSFTNGP09.phx.gbl... I have a com dll interface: Public Function Hulian_Acount_all(ByVal vIndex As Variant, _ ByRef vDate As Variant, _ ByRef vCount As Variant, _ ByRef vMoney As Variant, _ ByRef vMyDetail As Variant, _ ByVal vTimeStamp As Variant, _ ByVal vSPID As Variant, _ ByVal vType As Variant, _ ByVal vResult As Variant, _ ByVal vSenderID As Variant, _ ByVal vYourCount As Variant, _ ByVal vYourMoney As Variant, _ ByVal vDetail_result As Variant, _ ByVal vSucess_count As Variant, _ ByVal vSucess_money As Variant, _ ByVal vFail_count As Variant, _ ByVal vFail_money As Variant, _ ByVal vYour_records As Variant) I use it in C# like this: obj.Hulian_Acount_all
(3,"","","","",TimeStamp,"","",Result,SenderID,Tot alCount,TotalFee,"","","", "","","") ;
But the compiler shows out the error: "cannot convert the string to ref object"
How can I pass the 2 ~ 5 ByRef parameters to the dll in C# ? Thanks a
lot!
Thank you very much! I've resolved the problem with your help!
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> дÈëÏûÏ¢
ÐÂÎÅ:#Q**************@tk2msftngp13.phx.gbl... pecker,
Because they are declared as variants, you have to store your values
as type object first, and then pass them by ref. You will have to do this:
// The values. <value> are the values you want to pass. object vDate = <value>, vCount = <value>, vMoney = <value>, vMyDetail = <value>;
// Call the method. myObject.Hulian_Acount_all(vIndex, ref vDate, ref vCount, ref vMoney, ref vMyDetail, vTimeStamp, vSPID, vType, vResult, vSenderID, vYourcount, vYourMoney, vDetail_result, vSucess_count, vSucess_money, vFail_count, vFail_money, vYour_records);
Hope this helps.
-- - Nicholas Paldino [.NET/C# MVP] - mv*@spam.guard.caspershouse.com
"pecker" <pe********@sina.com> wrote in message news:uz**************@TK2MSFTNGP09.phx.gbl... I have a com dll interface: Public Function Hulian_Acount_all(ByVal vIndex As Variant, _ ByRef vDate As Variant, _ ByRef vCount As Variant, _ ByRef vMoney As Variant, _ ByRef vMyDetail As Variant, _ ByVal vTimeStamp As Variant, _ ByVal vSPID As Variant, _ ByVal vType As Variant, _ ByVal vResult As Variant, _ ByVal vSenderID As Variant, _ ByVal vYourCount As Variant, _ ByVal vYourMoney As Variant, _ ByVal vDetail_result As Variant, _ ByVal vSucess_count As Variant, _ ByVal vSucess_money As Variant, _ ByVal vFail_count As Variant, _ ByVal vFail_money As Variant, _ ByVal vYour_records As Variant) I use it in C# like this: obj.Hulian_Acount_all
(3,"","","","",TimeStamp,"","",Result,SenderID,Tot alCount,TotalFee,"","","", "","","") ;
But the compiler shows out the error: "cannot convert the string to ref object"
How can I pass the 2 ~ 5 ByRef parameters to the dll in C# ? Thanks a lot!
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Vanessa |
last post by:
Hi,
I would like to know whether there's any way for me to pass an object by
reference to another form?
Regards
Vanessa
|
by: John |
last post by:
Hi
I open a word document from my vb.net app. Now I want to pass reference to
one of the classes in my vb.net app to word so it can access procedures in
the vb.net class. How can I pass the...
|
by: Carlos Gomez |
last post by:
In VB6 the default for passing variables was ByRef. It was faster and
used less memory. Why did MS changed that? Are there any advantages
using ByVal over ByRef? (other than ByVal impeding you from...
|
by: Brett |
last post by:
I have several classes that create arrays of data and have certain
properties. Call them A thru D classes, which means there are four. I can
call certain methods in each class and get back an...
|
by: SQLScott |
last post by:
I know that passing variables "ByRef" to a web web service is permitted, but
what I am expreriencing is quite odd.
If I take out my ByRef parameter from the method of my web service, i can
step...
|
by: jg |
last post by:
just for those who have to deal with legacy application that supports COM,
OCX, and WINAPI(_stadcall) - c-style?,
I worked out the COM interface for function out array parameters.
For example...
|
by: Rob R. Ainscough |
last post by:
ASP.NET with VB.NET using 2.0 framework
I've created a class (myClass) under App_Code specific to my web
application.
I have a method in myClass called Display:
Public Function...
|
by: _Mario.lat |
last post by:
Hallo,
I have a little question:
In the function session_set_save_handler I can pass the name of function
which deal with session.
In Xoops code I see the use of this function like that:
...
|
by: David++ |
last post by:
Hi folks,
I would be interested to hear peoples views on whether or not 'pass by
reference' is allowed when using a Web Service method.
The thing that troubles me about pass-by-reference into...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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,...
|
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,...
|
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: 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,...
| |