Creating PIModule object in VB.NET

Discussion created by sunie on May 11, 2010
Latest reply on Jul 2, 2010 by michaelh

Hello guys! Im quite new to PI ACE development and I have stumbled upon a problem and I need your help.


I am trying to convert a VB6 code to I didn't use the upgrade wizard to avoid the errors that I might not know how to interpret. But anyways the code im working basically calculates for a Property, update the value in the module and then write this value into a PIProperty on a different PIModule. So I need to declare a PIModule object for that other Module which I'm having trouble doing. The orignal code in vb6 is something like this:

Dim PI_Server As PISDK.Server
Dim PI_Module  As PISDK.PIModule

Dim PI_Conv_Module As PISDK.PIModule

Set PI_Server = PISDK.Servers("MyServer")
Set PI_MDB = PI_Server.PIModuleDB

Set PI_Module = PI_MDB.PIModules("MyModuleName1").PIModules("SubModule1").PIModules.Item(strModuleName)

Set PI_Conv_Module = PI_MDB.PIModules("MyModuleName1").PIModules("SubModule2").PIModules(PI_Module.Name)

I know that PI_Module can be easily written as


'PI_Module = GetPIModuleFromPath(Context)' since the ACE code is running on the same context.


But how about the PI_Conv_Module? Can the 'GetPIModuleFromPath()' be also used in this case? I've tried this but I can't seem to use the correct 'path'.


Thanks for the help!!