VB.NET Crystal Reports Integer parameter
Before proceeding with this tutorial, it is essential to be aware that all programming samples presented here are based on the underlying database known as "crystaldb." To familiarize yourself with the database structure, kindly refer to the following link: Database Structure .
In this tutorial, our focus shifts towards passing an Integer parameter to Crystal Reports from VB.NET. This introduces a new aspect in comparison to the previous tutorial, where we explored passing a string parameter to Crystal Reports. Therefore, it is highly recommended to review the complete section on passing a string parameter to Crystal Reports from VB.NET to gain a comprehensive understanding of the overall process.
When passing an Integer parameter, we must create a new Integer parameter within the Parameter Fields section of the Field Explorer. By doing so, we gain access to the following screen, where we can input the necessary information based on the provided picture. This step enables us to establish the required parameter configuration within Crystal Reports.
Once the parameter field has been created, the next step involves creating the selection formula for Crystal Reports. To accomplish this, right-click on the Crystal Reports designer window and navigate to REPORT -> SELECTION FORMULA -> RECORD.
Upon selecting these options, the Record Selection Formula Editor will appear, allowing you to input the desired selection formula. To construct the formula, you will need to select the relevant fields from the available lists and combine them appropriately.
In this tutorial, we will illustrate the creation of a selection formula that selects records from the Product table where the value is greater than the input value. To achieve this, begin by selecting the field "Product_price" from the Product table. Next, choose the appropriate comparison operator, and finally, select the parameter that was created earlier. By double-clicking each field, they will automatically be added to the formula.
By following these steps, you will successfully construct the selection formula that filters the records based on the specified condition. This allows you to retrieve and display only the relevant data in the Crystal Reports based on the parameter input.
After the creation of selection formula close that screen .
Now the designing part is over and the next step is to call the created Crystal Reports in VB.NET through Crystal Reports Viewer control .
Select the default form (Form1.vb) you created in VB.NET and drag a Textbox , button and CrystalReportViewer control to your form.
Select Form's source code view and import the following :
- Imports CrystalDecisions.CrystalReports.Engine
- Imports CrystalDecisions.Shared
Put the following source code in the button click event
Full Source VB.NETcryRpt.Load("PUT CRYSTAL REPORT PATH HERE\CrystalReport1.rpt")
The Crystal Report is in your project location, there you can see CrystalReport1.rpt . So give the full path name of report here.
Now you can run the program . Enter any price , then you can see the report of the Product list whose price is greater than or equal to the entered price.
Here we got the result of Product list whose price is grater than 50.
- Sample Database and tables for Crystal Reports tutorials
- Step by Step help for creating a simple Crystal Reports in VB.NET
- VB.NET Crystal Reports from multiple tables
- VB.NET Crystal Reports String parameter
- VB.NET Crystal Reports Date parameter
- VB.NET Crystal Report Load Dynamically
- VB.NET Crystal Reports Formula Fields
- VB.NET Crystal Reports Summary Fields
- VB.NET Crystal Reports Export to PDF
- VB.NET Crystal Reports Export to Excel
- Email a Crystal Reports from VB.NET
- Crystal Reports Without Database
- Crystal Report from SQL Query String
- Dynamic Crystal Reports from SQL Query String
- Crystal Reports from XML File
- Create a Subreport in Crystal Reports
- Create a Subreport in Crystal Reports with Link
- How to deploy Crystal Reports on Clinet Machine
- How to create Crystal Reports installer using Merge Modules