Showing results 1 to 2 of 2

Thread: Modify Variable properties in VSTA

  1. #1
    Join Date
    16.05.2016
    Posts
    10

    Frage Modify Variable properties in VSTA

    Hi,

    Is there any one know how to modify or set properties of variables in VSTA?

    I use VSTA C# to create a variable using hardware driver, but I could not set the address for this variable.

    Thank you!
    Last edited by huybbc : 9th January 2017 at 14:17

  2. #2
    Join Date
    16.05.2016
    Posts
    10

    Default Re: Modify Variable properties in VSTA

    Quote Originally Posted by huybbc View Post
    Hi,

    Is there any one know how to modify or set properties of variables in VSTA?

    I use VSTA C# to create a variable using hardware driver, but I could not set the address for this variable.

    Thank you!
    Hi again,

    As I found the solution, I just want to share here. I tried as following and got it work fine:

    zenOn.IDrivers zenonDriver = this.myZenWork.ActiveDocument.Drivers();
    zenOn.IVariables zVar = this.myZenWork.ActiveDocument.Variables();
    zenOn.IVarTypes zVarType = this.myZenWork.ActiveDocument.VarTypes();
    zenOn.IDriver selectedDriver = zenonDriver.Item(selecteddriver);

    zVar.CreateVar(Var_name, selectedDriver, (zenOn.tpKanaltypes) selectedDataObjectType, zVarType.Item("UINT"));

    zVar.Item(Var_name).DataBlock = Var_DB;
    zVar.Item(Var_name).Offset = Var_Offset;


    Problem solved

Similar Threads

  1. Replies: 1
    Last Post: 19th January 2012, 00:01
  2. VSTA read variable value's another project!
    By dvangenderen in forum VSTA
    Replies: 5
    Last Post: 1st December 2011, 10:04
  3. Replies: 2
    Last Post: 22nd September 2011, 01:32
  4. Replies: 1
    Last Post: 2nd August 2011, 10:21

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •