jmolines

[SOLVED] Get the AF server name in a variable in VB processbook ?

Discussion created by jmolines on Jun 25, 2014
Latest reply on Jun 26, 2014 by jmolines

Hello, i'm looking for a way to get the name of the AF server on which my processbook is connected, in a variable in VB (macro processbook).

 

I already linked a Wrapper.dll (generated by the AFWrapper solution in C#) to my processbook References.

 

I tried to create differents method in my C# solution like :

 

[ComVisible(true)]
public static String GetDefaultAfServer()
{
PISystems piSystems = new PISystems();
return piSystems.DefaultPISystem.Name;
}

 

OR

 

[ComVisible(true)]
public static String TestGetDefaultAfServer(string test)
{
PISystems myPISystems = new PISystems();
PISystem myPISystem = myPISystems.DefaultPISystem;
string myDB = myPISystem.Databases.DefaultDatabase.Name;
return myDB;
}

 

And i try to call my methods through my VB like that (the name of my class is Wrapper) : 

 

Dim afname As String
Dim mywrapper As AFWrapper.Wrapper
Set mywrapper = New Wrapper
afname = mywrapper.GetDefaultAfServer()

 

I don't really master C# neither PI systems, but it seems i already success to make those methods visibles in my VB processbook, because i get this message :

 

"Object doesn't support this property of method"

 

I obviously miss something important or i just create my methods (and/or my way to call them) in the wrong way.

 

What did i do wrong ?

 

Best regards.

 


Outcomes