combit List & Label 24 - .NET Online Web Help
Pass Additional Contents
Programming Introduction > Examples > General > Database Independent 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();
}
Private Sub LL_AutoDefineNewLine(sender As Object, e As AutoDefineElementEventArgs) Handles LL.AutoDefineNewLine
    ' Switch to next record if necessary
    ' GetCurrentFieldValue is function of your application
    ' which returns the content of a data field.
    TryCast(sender, ListLabel).Fields.Add("AdditionalData.AdditionalField", GetCurrentFieldValue())
End Sub

// ...

Using LL As 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())

    ' ...

    ' Call the Designer
    LL.Design()

    ' Print
    LL.Print()
End Using