Skip to main content
A newer version of this page is available. .

Display the User Name in a Report

This tutorial demonstrates how to insert the current user name in a report using the XRPageInfo control.

HowTo - InsertUserName_3

Do the following to insert the user name into a report:

  1. To create a table report in this tutorial, start with a report that is bound to the “Products” table of the sample Northwind database (the nwind.mdb file included in the XtraReports installation). To learn more about binding a report to a data source, see Provide Data to Reports.
  2. In the Microsoft Visual Studio Designer, switch to the Field List, select the ProductName and UnitPrice fields, and drag-and-drop them onto the report’s Detail band.

    HowTo - FilterDataReportLevel_0

  3. Typically, the user name is displayed within the ReportHeaderBand. To add it to the report, right click anywhere on the report’s surface. In the invoked menu, point to Insert Band and click ReportHeader.

    Shared_BandsAddReportHeader

  4. Drop the XRPageInfo control from the DX.18.2: Report Controls Toolbox tab onto the ReportHeader band.

    HowTo - InsertUserName_0

  5. Set the control’s XRPageInfo.PageInfo property to UserName (e.g. using its smart tag).

    HowTo - InsertUserName_1

  6. Next, to apply a format string to the control’s contents, type Current User: {0} into its XRPageInfo.Format property.

    HowTo - InsertUserName_2

See Also