COMException : Invalid procedure call or argument

Z

Zoury

Hi there!

I'm using a COM component from my C# application and I can't get it to work
properly. I get a COMException (Invalid procedure call or argument) on this
line :

//***
ArbreSaisieClass as = new ArbreSaisieClass();
bool bSubLevel = true;
bool bValid = false;
bool bCalcPrice = false;
// the exception is raised on this line...
bool bRet = as.root.Revalidate(ref bSubLevel, ref bValid, ref bCalcPrice,
true);
//***

here's the original vb signature of the Revalidate function() :
'***
Public Function Revalidate _
( _
Optional ByRef bSubLevel As Boolean = False _
Optional ByRef bValid As Boolean = True _
Optional ByRef bCalcPrice As Boolean = True_
Optional ByVal bWithMessage As Boolean = True _
) As Boolean
'***

Any thoughts on the problem? True in VB is -1 whilst true in C# equals 1.
There may be something to do in order to pass a "good" value...
 
Z

Zoury

naaaa... :OP

the code is actually breaking on the line right before the one mentionned
earlier.. here it is :
//***
ArbreSaisie.ArbreClass as = new ArbreSaisie.ArbreClass();
string sProdNo = "PRD123";
string sTableFieldName = "PRD_NO";
string sDetTableFieldName = "DETCMD_NO";
string sFieldPrixBase = "0";
MSXML2.IXMLDOMDocument2 XMLVars = null;
string sForNo = "FOR345";
ArbreSaisie.Arbre arbre = new ArbreSaisie.Arbre();

as.LoadProduct(ref sProdNo, ref sTableFieldName, ref sDetTableFieldName,
ref sFieldPrixBase, false, ref XMLVars, ref sForNo, ref arbre);
//***

here's the vb signature code :
'***
Public Sub LoadProduct _
( _
ByRef p_strPrd_No As String, _
ByRef pFieldNameTable As String, _
ByRef pFieldNameDetTable As String, _
ByRef pFieldPrixBase As String, _
Optional ByVal init As Boolean, _
Optional ByRef XMLVars As MSXML2.DOMDocument30, _
Optional ByRef psForNo As String, _
Optional ByRef poOldArbre As ArbreSaisie.Arbre _
)
'***

Now i think the problem might be related to the XMLVars object and/or the
arbre object... any thoughts?
 
Z

Zoury

i think the problem is solved... but i got another error... :OP

We have to instanciate the interface object that are passed to the function
MSXML2.IXMLDOMDocument2 XMLVars = null;

<snip>

and this one isn't correct..
ArbreSaisie.Arbre arbre = new ArbreSaisie.Arbre();

both becomes :
//***
MSXML2.IXMLDOMDocument2 XMLVars = new DOMDocumentClass();
ArbreSaisie.Arbre arbre = new ArbreSaisie.ArbreClass();
//***

where the variable points to the interface implemented by the class..

now I'm getting a "Object variable or With block variable not set" (error
91) on the VB Side... at least the .NET side seems Ok. :O)

Thanks anyway!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top