Features, discussions, tips, tricks, questions, problems and feedback

AdroitCOM / StringList agent (slot listOfStrings)

What would be the procedure to modify the contents of the listOfStrings slot from a StringList agent?

  • How can you Remove an entry from this list?
  • How can you Add a new entry to this list?
  • How can you Update an existing entry in the list?

An example (c#) would be nice.

You cant update the listOfStrings slot directly for a stringlist agent

What you can do to add, remove and update a stringlist agent, is by changing its current index slot first and then updating the value slot, which is the value of the current index.

For example below I am updating the 2nd index with value “START” and adding a new 5th index with value “HALT”

 bool error = false;
 object errorMessage = null;

 Adroit adroit = new Adroit();
 adroit.Connect("your machine name", "your server name",ref error, ref errorMessage);

 if (!error)
 {
     // move stringlist index to 2 to update index 2
     adroit.PutSlot("SLIST", "index", 2, ref error, ref errorMessage);
     // set the new current index value to "START"
     adroit.PutSlot("SLIST", "value", "START", ref error, ref errorMessage);

     // move stringlist index to 5 to create a new index
     adroit.PutSlot("SLIST", "index", 5, ref error, ref errorMessage);
     // set the new current index value to "HALT"
     adroit.PutSlot("SLIST", "value", "HALT", ref error, ref errorMessage);
 }
 else
 {
     MessageBox.Show("Connection Error: " + errorMessage.ToString());
 }

Hope this helps.

1 Like

Thanks for the explanation, I’ll give it a try.

1 Like