Use grid ++ reports in VB

Source: Internet
Author: User

When I was working on the data center charging system some time ago, the selected time period in the form added to the weekly statement report should be displayed in the report, which has not been clarified yet. I accidentally figured it out from some code today. It is mainly to dynamically Add a static text box in the form to display the required text. The code and main form interfaces are as follows for everyone to study and learn.

Option explicitdim report as grprolibctl. gridppreportprivate sub rshow () dim strsql as string dim strmsg as string strsql = "select * From checkweek_info where date <= '" & format (cbotimestart. text, "yyyy-mm-dd") & "'and date <='" & format (cbotimeend. text, "yyyy-mm-dd") & "'" Set Report = new grprolibctl. gridppreport. loadfromfile (App. path & "\ checkweek. GRF ") 'Load the template report. detailgrid. recordset. connectionstring = connstring 'data source report. detailgrid. recordset. querysql = strsql' create a record set through SELECT query '================= custom controls in reports ======== ======== dim reportheader as igrreportheader dim staticbox as igrstaticbox set reportheader = report. insertreportheader: Insert a static text box to display the text set staticbox = reportheader. controls. add (grctstaticbox ). asstaticbox staticbox. TEXT = cbotimestart. text & "to" & cbotimeend. text staticbox. width = 500 '========================================== ====================== grdisplayviewer1.report = Report grdisplayviewer1.startend subprivate sub cmdrefresh_click () grdisplayviewer1.refresh 'refresh end subprivate sub into view_click () report. printpreview (true) 'print and preview end subprivate sub into print_click () report. [print] (true) 'print end sub

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.