Hi,
I don't know if I understood your suestion very good, but I thought you
wanted to chose at runtime the report to show? I'm using myself a solution
like this: One form, that contains one reportviewer, and I'm using the same
to show all my reports (based on a parameter).
This is my code:
'This comes in the form-load
Me.rpvwReport.ProcessingMode =
Microsoft.Reporting.WinForms.ProcessingMode.Remote
'"ReportServerUrl"="http://MyServer/reportserver2005"
Me.rpvwReport.ServerReport.ReportServerUrl = New
System.Uri(System.Configuration.ConfigurationManag er.AppSettings.Get("ReportServerUrl"),
System.UriKind.Absolute)
'method to show a given report (defines buy my variabel Me.m_ReportType)
Public Overridable Sub Fill()
Dim colPrm As New Generic.List(Of ReportParameter)
Dim prm As ReportParameter
Dim clsRep As clsReport = Nothing
Try
Select Case Me.m_ReportType 'select which report to show
(currently only one)
Case enumReportType.RepDemandeDeCotation
'charge le rapport de la DemandeDeCotation
clsRep =
clsWorkSpace.MyWorkSpace.GetReportFromReportName(" DemandeDeCotation")
prm = New ReportParameter("intCotationID",
Me.m_Document.PrimaryKey)
colPrm.Add(prm)
prm = New ReportParameter("intPersonneID",
Me.cmbResponsable.SelectedValue.ToString)
colPrm.Add(prm)
End Select
'52RE6_001.pdf"
Catch ex As Exception
ErrorMessage(ex, "Select Case Me.m_ReportType")
End Try
Try
If clsRep Is Nothing Then
'problem
MessageBox.Show("Le rapport ne peut pas être trouvé sur le
serveur.", "Pas de rapport", MessageBoxButtons.OK, MessageBoxIcon.Error)
Else
Me.rpvwReport.ServerReport.ReportPath = clsRep.ReportPath
Me.rpvwReport.ServerReport.SetParameters(colPrm)
Me.rpvwReport.RefreshReport()
End If
Catch ex As Exception
ErrorMessage(ex, "SetParameters")
End Try
Me.HasLoaded = True
End Sub
"Xpeppe" <xp****@libero.it> wrote in message
news:a9********************@twister2.libero.it...
Hy, i read the article in msdn2
Using a Database Data Source with the ReportViewer Windows Forms Control
in Local Processing Mode
But i don want to use the designer assosation to the report,
i want to define by code (at run time) the report and the
data source to be display.
example :
i have two table on sqlclient db file (anagrafica and pratica)
and i have two report (rpt_anagrafica.rdlc and rpt_pratica.rdlc)
in a form a have two button, one for visualize the first repor (whit his
data anagrafica) and
one to visualize the second report (whit his data pratica) ,
when run the application i want to decide what report to be visualize.
for this i don't now what is the metod
have yuo any example ?
I hope explain correctly (sorry for my english) thank's.