Using the MS ReportViewer control. Code. Displaying search results

Posted by dragon on Friday, 30 September 2011

Private Sub AnteRicercaToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RicercaTipoAnteToolStripMenuItem.Click

If Me.txtTipo.Text = "" Or Me.txtRicerca.Text = "" Then
MsgBox("Effettuare prima la ricerca", MsgBoxStyle.Critical)
Exit Sub

End If

Report(My.Application.Info.DirectoryPath & "\AnteRicercaTipo.rdl", "Biblioteca")

RepTipo.ReportViewer1.Refresh()

RepTipo.Show()

End Sub


Private Sub Report(ByVal filename As String, ByVal table As String)

Dim RepDS As New ReportDataSource

Dim dv As New System.Data.DataView

dv = DataSet1.Tables(table).DefaultView

RepDS.Name = "DataSource1"
RepDS.Value = dv
RepTipo.ReportViewer1.LocalReport.DataSources.Clear()
RepTipo.ReportViewer1.LocalReport.DataSources.Add(RepDS)

RepTipo.ReportViewer1.LocalReport.ReportPath = filename

End Sub

Trying in google you will be able to find much documentation on how creating a report. In particular I council this link for customizining layout of report and the this link for a practice with ReportViewer.
If you have of the problems with these articles you can contact me obviously.
N.B.
Currently my acquaintances are limited to the type of report which I have created. Perhaps in future I will widen my acquaintances.


{ 0 comments... read them below or add one }

Post a Comment