How to change the caption of a text in a dynamo via VB?

Long time VB user, but I am new to DeltaV and I have been unable to find what I am looking for through Google and the help files in DeltaV so maybe someone here can help.

I've created a user form that pops up after the Dynamo Properties window where you set the module name.  The issue I am having is that I need to access the Text object within the dynamo and change it's caption based upon user input.  I'm trying to create a multi-use dynamo that each copy of the dynamo can have different text.

I can't set the dynamo's data source to a User defined variable, as that will change the text of every copy of this dynamo.

I do realize that there is a challenge to this as the name of the Text object within the dynamo will change as more than one copy of the dynamo changes the name of the Text object.

If there is a way to do this, anyone got the VB code to accessing the Caption of a text object in a dynamo?

If not, any ideas on how I can get this accomplished?

  • Hi Raytrace,

    I am giving you suggestion without VB and DeltaV Operate environment. But i hope it will help you in some way.

    please try following following steps.
    1. Provide unique name to the Text object in the dynamo. e.g."txt_DynamoCaption"
    2. Create string type User defined variable in dynamo. e.g. name "PS_Friendlyname"
    2. Assuming User input on customised form are on "Friendlyname" named object. (Replace here with your object name on the customized form)
    3. Write following script on Ok button.

    Dim objText as object
    Dim objVar as object
    Set Objtext = Nothing
    Set ObjVar =Nothing
    Set Objtext = findlocalobject (objdynamo, "txt_DynamoCaption")
    Set ObjVar = findlocalobject (objdynamo, "PS_Friendlyname")
    ObjText.caption=Friendlyname.Value
    objVar.currentValue= Friendlyname.Value
    objVar.InitialValue= objVar.currentValue



    Also on form_activate, please write:
    Dim objVar as object
    Set ObjVar = findlocalobject (objdynamo, "PS_Friendlyname")
    Friendlyname.Value=objVar.currentValue