VB中使用Grid++报表
2011-08-12 07:37
190 查看
前段时间做机房收费系统的时候,在周结账单的报表中添加窗体中选定的时间段要在报表中显示,在这一点上一直没有弄清楚。今天无意中从一些代码中弄明白了。主要是在窗体中动态的添加一个静态文本框来显示我们需要的文字。代码和主要的窗体界面如下,供大家一起研究学习
Option Explicit
Dim Report As grproLibCtl.GridppReport
Private 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
Report.LoadFromFile (App.Path & "\checkWeek.grf") '加载模版
Report.DetailGrid.Recordset.ConnectionString = ConnString '数据源
Report.DetailGrid.Recordset.QuerySQL = strSQL '通过SELECT查询创建记录集
'=================报表中自定义控件================
Dim Reportheader As IGRReportHeader
Dim StaticBox As IGRStaticBox
Set Reportheader = Report.InsertReportHeader
'插入一个静态文本框,显示需要显示的文字
Set StaticBox = Reportheader.Controls.Add(grctStaticBox).AsStaticBox
StaticBox.Text = cboTimeStart.Text & " 至 " & cboTimeEnd.Text
StaticBox.Width = 500
'======================================================
GRDisplayViewer1.Report = Report
GRDisplayViewer1.Start
End Sub
Private Sub cmdRefresh_Click()
GRDisplayViewer1.Refresh '刷新
End Sub
Private Sub cmdView_Click()
Report.PrintPreview (True) '打印预览
End Sub
Private Sub cmdPrint_Click()
Report.[Print] (True) '打印
End Sub
Option Explicit
Dim Report As grproLibCtl.GridppReport
Private 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
Report.LoadFromFile (App.Path & "\checkWeek.grf") '加载模版
Report.DetailGrid.Recordset.ConnectionString = ConnString '数据源
Report.DetailGrid.Recordset.QuerySQL = strSQL '通过SELECT查询创建记录集
'=================报表中自定义控件================
Dim Reportheader As IGRReportHeader
Dim StaticBox As IGRStaticBox
Set Reportheader = Report.InsertReportHeader
'插入一个静态文本框,显示需要显示的文字
Set StaticBox = Reportheader.Controls.Add(grctStaticBox).AsStaticBox
StaticBox.Text = cboTimeStart.Text & " 至 " & cboTimeEnd.Text
StaticBox.Width = 500
'======================================================
GRDisplayViewer1.Report = Report
GRDisplayViewer1.Start
End Sub
Private Sub cmdRefresh_Click()
GRDisplayViewer1.Refresh '刷新
End Sub
Private Sub cmdView_Click()
Report.PrintPreview (True) '打印预览
End Sub
Private Sub cmdPrint_Click()
Report.[Print] (True) '打印
End Sub
相关文章推荐
- QX Grid Report Designer(强新报表开发软件)使用教程
- UniGUI使用报表Grid++Repor的方法之一(静态调用)
- Lazarus 中使用Grid++Report报表控件 的简单例子
- 在VB中使用水晶报表的一种简易编程方法
- uniGUI中使用Grid++Report设计报表
- 水晶报表使用CDO可以在内存中建立一个临时数据库,类似于VB的那个DataSet
- 机房收费系统(二)报表的设计Grid 的使用
- Grid++Report 报表动态使用
- UniGUI使用报表Grid++Repor的方法之二(动态调用)
- VB.NET从VS2003升到VS2005后报表无法使用的解决方法
- vb.net使用水晶报表显示动态Dataset的数据
- VB.NET rdlc 报表的使用
- Vb中使用报表控件(二)
- VB中使用报表控件(一)
- GridReport 5.0 报表的使用
- VB报表设计中使用天宇报表控件
- 在asp.net mvc中如何使用Grid++ Report (锐浪报表)
- 在VB中使用动态分组报表
- grid++报表使用时注意事项
- 在VB中使用水晶报表总结