bboo
asked on
Added Tab Page programatically to Crystal Report Viewer
I have the following function that changes my crystal reports default 'MainReport' to 'XYZ' text. What I cannot figure out to do is how to add another tab page to the report programatically and then run sql to return the data in that tab page...
In a nutshell, I have:
Dim rpt As New MyReport
' where the ds is a dataset from an sql query
rpt.SetDataSource(ds.Table s(0))
CrystalReportViewer.Report Source = rpt
SetTabPage()
CrystalReportViewer.Visibl e = True
Private Function SetTabPage() As Boolean
Dim I As Integer
Do While I < CrystalReportViewer.Contro ls.Count
If TypeOf (CrystalReportViewer.Contr ols(I)) Is CrystalDecisions.Windows.F orms.PageV iew Then
Dim J As Integer
Do While J < CrystalReportViewer.Contro ls.Count
If CType(CrystalReportViewer. Controls(I ).Controls (J), System.Windows.Forms.TabCo ntrol).Tab Pages.Coun t > 0 Then
CType(CrystalReportViewer. Controls(I ).Controls (J), System.Windows.Forms.TabCo ntrol).Tab Pages.Item (0).Text = "XYZ"
'CType(CrystalReportViewer .Controls( I).Control s(J), System.Windows.Forms.TabCo ntrol).Tab Pages.Add( ?????????? ?)
Exit Do
End If
Loop
Exit Do
Else
CrystalReportViewer.Contro ls(I).Visi ble = False
End If
Loop
End Function
******** The spot with the ?????? is where I would like the TabPage added ****
The second piece is the how do I direct the dataset to a tab page on the Crystal report ...
Thanks!
In a nutshell, I have:
Dim rpt As New MyReport
' where the ds is a dataset from an sql query
rpt.SetDataSource(ds.Table
CrystalReportViewer.Report
SetTabPage()
CrystalReportViewer.Visibl
Private Function SetTabPage() As Boolean
Dim I As Integer
Do While I < CrystalReportViewer.Contro
If TypeOf (CrystalReportViewer.Contr
Dim J As Integer
Do While J < CrystalReportViewer.Contro
If CType(CrystalReportViewer.
CType(CrystalReportViewer.
'CType(CrystalReportViewer
Exit Do
End If
Loop
Exit Do
Else
CrystalReportViewer.Contro
End If
Loop
End Function
******** The spot with the ?????? is where I would like the TabPage added ****
The second piece is the how do I direct the dataset to a tab page on the Crystal report ...
Thanks!
Can you explain a little bit more detail what you're trying to do?
This may be what you need
http://support.businessobjects.com/communityCS/FilesAndUpdates/SCR_RDC_tabs.exe.asp
mlmcc
http://support.businessobjects.com/communityCS/FilesAndUpdates/SCR_RDC_tabs.exe.asp
mlmcc
ASKER
The link sent by mlmcc is not for VB .NET .. I am using Crystal Descisions 9. plus I am not using the CRViewer. I am using CrystalReportViewer.
For frodoman:
I am trying to add a tab to CrystalReportViewer that is on a form. The CrystalReportViewer has a default tab called 'MainReport'. I have found how to change to Tab Text for MainReport to 'XYZ' as you can see in my question. The report displays data from a dataset. This all works fine.
1) I would like to be able to add another tab to the CrystalReportViewer.
After I know how to do this ...
2) I would like to know how to direct dataset1 to the first tab and dataset2 to the second tab.
This is a VB .NET application.
Thanks!
For frodoman:
I am trying to add a tab to CrystalReportViewer that is on a form. The CrystalReportViewer has a default tab called 'MainReport'. I have found how to change to Tab Text for MainReport to 'XYZ' as you can see in my question. The report displays data from a dataset. This all works fine.
1) I would like to be able to add another tab to the CrystalReportViewer.
After I know how to do this ...
2) I would like to know how to direct dataset1 to the first tab and dataset2 to the second tab.
This is a VB .NET application.
Thanks!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.