/
Form1.vb
55 lines (45 loc) · 1.8 KB
/
Form1.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
Imports System
Imports System.Windows.Forms
Imports DevExpress.XtraReports.UI
Imports DevExpress.XtraReports.Parameters
' ...
Namespace Report_ParametertsPanel
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub simpleButton1_Click(ByVal sender As Object, _
ByVal e As EventArgs) Handles simpleButton1.Click
' Create a report instance.
Dim report As New XtraReport1()
' Create a parameter and specify its name.
Dim param1 As New Parameter()
param1.Name = "CatID"
' Specify other parameter properties.
param1.Type = GetType(System.Int32)
param1.Value = 1
param1.Description = "Category: "
param1.Visible = True
' Add the parameter to the report.
report.Parameters.Add(param1)
' Specify the report's filter string.
report.FilterString = "[CategoryID] = [Parameters.CatID]"
' Force the report creation without previously
' requesting the parameter value from end-users.
report.RequestParameters = False
' Show the parameter's value on a Report Header band.
Dim label As New XRLabel()
label.DataBindings.Add(New XRBinding(param1, "Text", "Category: {0}"))
Dim reportHeader As New ReportHeaderBand()
reportHeader.Controls.Add(label)
report.Bands.Add(reportHeader)
' Assign the report to a ReportPrintTool,
' to hide the Parameters panel,
' and show the report's print preview.
Dim pt As New ReportPrintTool(report)
pt.AutoShowParametersPanel = True
pt.ShowPreviewDialog()
End Sub
End Class
End Namespace