I have created a COM dll written in C#. It is registered successfully and I am trying to access it in VB script. I am able to create the object of the COM and am able to execute first method call.
When I try to execute the second method call (msg = app.getSubDomainConn( domain)), with the object returned by first method call, I get following error. I have posted both VBscript and C# code.
Could someone please help?
Error: Invalid procedure call or argument: 'getValidConnectionMsg'
Code: 800A0005
Source: Microsoft VBScript runtime error
dim app
Set app = CreateObject("myCOM.myObject.")
app.uri=<URI>
app.username=<User>
app.password=<pwd>
Dim domain
Set domain = app.getDomain()
domain.ok = true;
wscript.echo domain.name
dim msg
msg = app.getSubDomainConn(domain)
Here is C# code.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace myCOM
{
public class myObject
{
public String uri = "";
public String username = "";
public String password = "";
public IDomain getDomain()
{
String msg = "";
IDomain domain = null;
try
{
// Get domain Connection
IConnection conn = Factory.Connection.GetConnection(uri);
UserCredentials creds = new UsernameCredentials(username, password);
// Get domain.
domain = Factory.Domain.Get(conn);
}
catch (Exception exc)
{
Console.WriteLine(exc.ToString());
}
return domain;
}
public String getValidConnectionMsg(IDomain domain)
{
String isDomainAvailable = "Not Available";
if (domain != null)
{
isDomainAvailable = domain.Name;
}
return isDomainAvailable;
}
}
}
getValidConnectionMsgin your code somewhere?"getValidConnectionMsgfrom VBScript, so you cannot be getting that error. Instead you are callinggetSubDomainConnfrom VBScript, which is not even present as a method inmyObject. Which is why you were asked, Is getValidConnectionMsg in your code somewhere.