I am working towards creating a "paste as reference" routine using the API for our ECO/ECN procedure, and am becoming re-acquainted with VB programming. My first step was to simply pass the filename of a selected file to a variable on the card of the parent file (sounds simple right). The variables within my code all seem to work but the SetVar command doesn't populate the target card variable even when I hard code it. Portion of code below.
================================================================= Dim vars As IEdmEnumeratorVariable8 vars = poCmd.mpoExtra Dim VariantPath As Object VariantPath = path 'vars.SetVar(VarName, "", VariantPath, 0 vars.SetVar("ECO_AffItem1", "", "New Value") 'Hardcode for test System.Windows.Forms.MessageBox.Show(vault.GetWin32Window(poCmd.mlParentWnd),"Variable: " + VarName + "Populated With: " + VariantPath) ===================================================================== Thanks
Hi, I have used the following in vb.net with some success. It is a public shared sub but doesn't have to be.
Public Shared Sub SetData(ByRef DestFile As IEdmFile5, ByVal MyVariable As String, ByVal MyVarVal As String)
' set variable in destination file
Dim varEnum As IEdmEnumeratorVariable8 ' declare enumerator
varEnum = DestFile.GetEnumeratorVariable ' set to destination file
varEnum.SetVar(MyVariable,"", MyVarVal) ' set variable
varEnum.CloseFile(True) ' close file
End Sub
you need to pass the file, then the variable name then the variable value.
hope this helps
David