Jump to content
Nelson Sousa

É possível mais de um subreport no reportviewer?

Recommended Posts

Nelson Sousa

Olá pessoal,

Estou usando o VS2010 no WIN7.

É possível a colocação de mais de um subreport num relatório pai?

Em caso positivo, como faze-lo?


Um Abraço,

Nelson Sousa

Share this post


Link to post
Share on other sites
Nelson Sousa

Ok,

Mas tenho uma dúvida quanto aos datasources.

Vou criar um para cada sub-report dentro do mesmo SubreportProcessingEvent?

Veja como faço para 1 sub-report:

   Public Sub SubreportProcessingEvent(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)
    Try
	    Dim ds_Subs As DataSet
	    Dim Busca As New Cls_Dados
	    ds_Subs = Busca.RetornarDataSet(str_SQL_Sub_Report)
	    Dim rptDataSource As New ReportDataSource _
										  ("DS_Sub", ds_Subs.Tables(0))
	    e.DataSources.Add(rptDataSource)
    Catch ex As Exception
	    MessageBox.Show(ex.Message, My.Application.Info.Title, _
									 MessageBoxButtons.OK, MessageBoxIcon.Error)
    End Try
   End Sub

Edited by Nelson Sousa

Um Abraço,

Nelson Sousa

Share this post


Link to post
Share on other sites
Nelson Sousa

Acabei resolvendo fazendo um loop dentro do SubreportProcessingEvent

	    For I = 0 To (int_Qtde_Subs - 1) 'Faz loop pela qtde de subs informada na int_Qtde_subs
		    ds_Subs = Busca.RetornarDataSet(str_SQL_Sub_Report(I))
		    Dim rptDataSource As New ReportDataSource("DS_Sub" & I, ds_Subs.Tables(0))
		    e.DataSources.Add(rptDataSource)
	    Next


Um Abraço,

Nelson Sousa

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.