1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
private System.Windows.Forms.BindingSource bindingSource;
private System.ComponentModel.IContainer component= null;
private Microsoft.Reporting.WinForms.ReportDataSource reportDataSource;
private void PrepareReport()
{
// on commence par définir les data sources
this.component= new System.ComponentModel.Container();
this.reportDataSource= new Microsoft.Reporting.WinForms.ReportDataSource();
this.bindingSource = new System.Windows.Forms.BindingSource(this.component);
((System.ComponentModel.ISupportInitialize)this.bindingSource).BeginInit();
this.reportDataSource.Name = "Post";
this.reportDataSource.Value = this.bindingSource;
// puis à ajouter la data source au rapport
this.viewerInstance.LocalReport.DataSources.Add(reportDataSource);
// paramètres du rapport
this.viewerInstance.LocalReport.ReportPath = @"./Reports/AR.rdlc";
this.viewerInstance.Location = new System.Drawing.Point(0, 0);
this.viewerInstance.ShowDocumentMapButton = true;
this.viewerInstance.ShowBackButton = true;
this.viewerInstance.ShowPageNavigationControls = true;
this.viewerInstance.RefreshReport();
((System.ComponentModel.ISupportInitialize)this.bindingSource).EndInit();
}
public void Report(ObjetMetier1 objetMetier)
{
this.bindingSource.DataSource = objetMetier
this.viewerInstance.RefreshReport();;
} |
Partager