combit List & Label 30 - .NET Help
Programming Introduction / Examples / General / Database Independent Contents / Pass Additional Contents
Pass Additional Contents

If only a few variables or fields are to be added to the data of the data source, there are two possibilities:

The following example shows both approaches:

void LL_AutoDefineNewLine(object sender, AutoDefineNewLineEventArgs e)
{
    // Switch to next record if necessary
    // GetCurrentFieldValue is function of your application
    // which returns the content of a data field.
    (sender as ListLabel).Fields.Add("AdditionalData.AdditionalField", GetCurrentFieldValue());
}

// ...

using (ListLabel LL = new ListLabel())
{
    // Define/Assign data source
    LL.DataSource = CreateDataSet();

    // Define additional data fields
    LL.Variables.Add("AdditionalData.UserName", GetCurrentUserName());
    LL.Variables.Add("AdditionalData.ProjectName ", GetCurrentProjectName());

    // ...

    // Add event handling for own fields
    LL.AutoDefineNewLine += new AutoDefineNewLineHandler(LL_AutoDefineNewLine);

    // Call the Designer
    LL.Design();

    // Print
    LL.Print();
}