VB display time through Grid Report

Source: Internet
Author: User

In the data room charging system, the "weekly bill" function displays the corresponding bill data based on the selected time range. Then, the "parameter" setting is used.

First, insert the parameter in "report main object": Right-click "parameter set" -- insert -- parameter (DateBegin and DateEnd)
Then, insert the integrated text box -- insert -- Part Box -- integrated text box in the report template, and click the text box to enter the parameter name and displayed text in the format of [# Parameter1 #]. (set the time display format ):
First, add the component Grid ++ Report Engine5.0 Type Libirary to VB.
In VB, set the corresponding code:
'Define the variable with the corresponding event Dim WithEvents Report As grproLibCtl. gridppReportPrivate Sub Form_Load () 'create a Report object GRDisplayViewer1.Stop Set Report = New grproLibCtl. gridppReport: load the Report template file to ensure the relative path is Report. loadFromFile (App. path + "ChargeCheckDay. grf ")
'Set the database connection string Report. detailGrid. recordset. connectionString = "Provider = SQLOLEDB; Data Source = 192.168.24.54; Initial CataLog = Charge_zlj; UID = sa; PWD = 123456" 'displays the latest Report record in daily checkout. detailGrid. recordset. querySQL = "select top 1 * from CheckDay order by Date desc" 'sets the Report object GRDisplayViewer1.Report = report' for the Report query display control to run GRDisplayViewer1.Start End SubPrivate Sub Report_Initialize () 'set the parameter value' start time Report. parameterByName ("DateBegin "). asString = Format $ (DTPBegin. value, "yyyy-mm-dd") 'show start date' End Time Report. parameterByName ("DateEnd "). asString = Format $ (DTPEnd. value, "yyyy-mm-dd") 'display End date End SubPrivate Sub partition print_click () 'Print' because the Print method name of the report object conflicts with the internal definition of VB, therefore, enclose the Report in brackets. [Print] (True) End SubPrivate Sub partition printprevius_click () 'Print preview Report. printPreview (True) End Sub

Effect:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.