Showing results 1 to 2 of 2

Thread: Accessing/Modifying Zenon-Listbox form VSTA

  1. #1
    sph11 Gast

    Ausrufezeichen Accessing/Modifying Zenon-Listbox form VSTA


    i need do add Vaules to a Zenon Listbox and read the selected Elements form VSTA.
    I have tryed the same way like in VBA but it doesn't work.

    ListBox MyListBox = new ListBox();
    MyListBox = (ListBox)this.DynPictures().Item("Windowname").Elements().Item("ListBoxName").AktiveX();
                MyListBox.Items.Add("Tru Tra Tralla");

    Well i hope someone can help me.

  2. #2
    Join Date

    Default AW: Accessing/Modifying Zenon-Listbox form VSTA


    editing the zenon Combo/Listbox via VBA/VSTA works only in the zenon Editor.

    Here is a short example how to change the value & text of a listbox entry:
    The example assumes you have a screen with the name "Start" in your project. The screen contains a listbox element with the name "Listbox" which contains some entries.

    zenOn.IDynPictures zpics;
    zenOn.IDynPicture zpic;
    zenOn.IElements zeles;
    zenOn.IElement zele;
    zpics = this.ActiveDocument.DynPictures(); //get all screens
    zpic = zpics.Item("Start"); //get the actual screen, Start ... name of the screen
    zeles = zpic.Elements(); //get all elements in the Start screen
    zele = zeles.Item("Listbox");   //get the listbox, Listbox ... name of the element listbox
    zele.set_DynProperties("States[0].Value", 10); //set the value 10 for the first listbox element
    zele.set_DynProperties("States[0].Text", "New text"); //set the text "New text" for the first element

    To get the several DynProperties you can take a look on the XML export of the Screen:

    Here you can see the States node (first entry in the listbox) from the XML Export
    Click image for larger version

Name:	DynProperties.PNG
Views:	91
Size:	12.5 KB
ID:	521


Similar Threads

  1. Accessing the rgm recipe name combobox
    By andreacold in forum VBA
    Replies: 3
    Last Post: 24th February 2014, 14:35
  2. Populate listbox from SQL
    By macdaddy in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 2
    Last Post: 9th August 2010, 13:28
  3. Replies: 1
    Last Post: 3rd August 2010, 10:02
  4. Replies: 0
    Last Post: 12th May 2010, 09:58
  5. MS Forms 2.0 Listbox
    By perschke in forum VBA
    Replies: 1
    Last Post: 23rd October 2009, 07:07

Posting Rules

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