Click here to Skip to main content
16,016,394 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hii .. Frindes

pls.. pls..

how use tow reports in one reportviewer vb.net 2010
Posted
Comments
thatraja 5-Mar-14 4:18am    
reportviewer? which one? crystal reports? rdlc, ssrs?

1 solution

VB
Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
Public Class Form10

    Dim Rpt As New ReportDocument

    Private Sub btn_rpt1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_rpt1.Click
        Dim frmView As New Form3 'Crystal Report viewer form
        Rpt = New CrystalReport1 'Your Crystal Report Name
        If Rpt.Rows.Count > 0 Then
            MsgBox("There is no data to show in report!")
            Exit Sub
        End If
        Rpt.Refresh()
        'frmView.CrystalReportViewer1.SelectionFormula = ("{Table1.pt_id}='" & Trim(Me.TextBox1.Text) & "'") 'Your selection formula if you need two fields just use this type ("{Table1.pt_id}='" & Trim(Me.TextBox1.Text) & "' and "{Table1.visit_id}='" & Trim(Me.TextBox2.Text) & "'")
        frmView.CrystalReportViewer1.ReportSource = Rpt
        frmView.CrystalReportViewer1.RefreshReport()
        frmView.Show()
    End Sub

    Private Sub btn_rpt2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btn_rpt2.Click
        Dim frmView As New Form3 'Crystal Report viewer form
        Rpt = New CrystalReport2 'Your Crystal Report Name
        If Rpt.Rows.Count > 0 Then
            MsgBox("There is no data to show in report!")
            Exit Sub
        End If
        Rpt.Refresh()
        'frmView.CrystalReportViewer1.SelectionFormula = ("{Table1.pt_id}='" & Trim(Me.TextBox1.Text) & "'") 'Your selection formula if you need two fields just use this type ("{Table1.pt_id}='" & Trim(Me.TextBox1.Text) & "' and "{Table1.visit_id}='" & Trim(Me.TextBox2.Text) & "'")
        frmView.CrystalReportViewer1.ReportSource = Rpt
        frmView.CrystalReportViewer1.RefreshReport()
        frmView.Show()
    End Sub
End Class
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900