SDK 2017 - Iterating trough variables

Label printing integration (NiceWatch middleware and ActiveX programming interface)

Moderators: Georges, milos, NiceLabel Support Team

Post Reply
Posts: 16
Joined: Tue Jul 29, 2014 10:41 am

SDK 2017 - Iterating trough variables

Post by lonewolf » Thu May 31, 2018 10:26 am

Hi to everybody, I have a question about NiceLabel SDK 2017.
I need to open a label and acquire all the variables it contains. I saw in the SDK sample the there is the IVariableLIst interface that access the label variables (trough Item propertiy) but with this object I must specify the name of each variable in order to get it.
I need to read variable information of the label but I don't have the variables name, rather I need to acquire this names. So my question is: there is a way to iterate though all variable contained in a label in order to acquire their names?
Many thanks in advance.


User avatar
NiceLabel Development
NiceLabel Development
Posts: 691
Joined: Tue Sep 12, 2006 12:50 pm
Location: Kranj, Slovenia

Re: SDK 2017 - Iterating trough variables

Post by dado » Fri Jun 01, 2018 6:44 am

Hi Eros

Yes there is. You can get it from the IVariableList. Please try this:

Code: Select all

            ILabel label = PrintEngineFactory.PrintEngine.OpenLabel(@"c:\tmp\SimpleLabel.lbl");
            string allVariableNames = null;
            foreach (IVariable variable in label.Variables)
                string variableName = variable.Name;
                allVariableNames += variableName + ", ";
Regards, Damjan

Post Reply