vbレポート作成(かつてステーション)



ステップ1:grid++reportのダウンロードインストール(grid++reportのダウンロード)
ステップ2:レポートテンプレートを作成します.(レポートテンプレートの作成方法)
ステップ3:適用と部品の追加(部品:および参照:)
ステップ4:VBでレポートを接続します.(レポートの場所app.pathが一番便利)
Dim WithEvents Report As grproLibCtl.GridppReport

Private Sub cmdPre_Click()
    Report.PrintPreview (True)
End Sub

Private Sub cmdPrint_Click()
   '        Print      VB        ,          
    Report.[Print] (True)
End Sub

Private Sub Command1_Click()
        GRDisplayViewer1.Refresh
End Sub

Private Sub Form_Load()
    '      
    Set Report = New grproLibCtl.GridppReport
    '        
    Report.LoadFromFile ("C:\Users\HAIFANG\Desktop\      1.0\byDay.grf") '
    strTxtSQL = "select * from allbyday_tableInfo where date='" & Format(Now, "yyyy-mm-dd") & "'"
  '       
    Report.DetailGrid.Recordset.ConnectionString = "FILEDSN=computerChargeSys.dsn;UID=sa;PWD=123456"
    Report.DetailGrid.Recordset.QuerySQL = strTxtSQL
    
    GRDisplayViewer1.Report = Report
    GRDisplayViewer1.Start
    
    
End Sub
 
Private Sub Form_Resize()
    GRDisplayViewer1.Left = 0
    GRDisplayViewer1.Width = Me.Width - 500
End Sub

Private Sub Report_Initialize()

    '        
                          
    Report.ParameterByName("makedate").AsString = Format$(Date, "yyyy-mm-dd")    '      
'    Report.ParameterByName("DateEnd").AsString = Format$(DTPEnd.Value, "yyyy-mm-dd")        '      
'
End Sub

レポートGridReportに日時の変更を表示します.http://blog.csdn.net/xiaoxian8023/article/details/6689474