
I have tried this. But not working.
public void HideTabs(CrystalReportViewer viewer)
{
foreach (Control control in viewer.Controls)
{
if (control is PageView)
{
TabControl tab = (TabControl)((PageView)control).Controls[0];
tab.ItemSize = new Size(0, 1);
tab.SizeMode = TabSizeMode.Fixed;
tab.Appearance = TabAppearance.Buttons;
}
}
}
Controls array not having any control.
Nilanka DharmadasaPosted Jan 6, 2010, 4:44 AM
Sorry for taking time to give you the correct answer.
The reason for your issue is, you should call this code after you set the report source. If the report source is null, as you said, it has no controls and the your mathod throws an exception.
So make sure that the report source is set, before you call your method.
If you find this useful, please tick 'Do you like this answer' checkbox.
gowrisankar LPosted Mar 14, 2013, 7:34 AM
Dim crvObject As Object
For Each crvObject In Me.MainCrystalReportViewer.Controls
If crvObject.GetType Is GetType(CrystalDecisions.Windows.Forms.PageView) Then
myPageView = CType(crvObject, CrystalDecisions.Windows.Forms.PageView)
Dim crvObjectControl As Object
For Each crvObjectControl In crvObject.controls
If crvObjectControl.GetType Is GetType(TabControl) Then
tbcReportTab = crvObjectControl
End If
Next
End If
Next
With tbcReportTab
.ItemSize = New Size(0, 1)
.SizeMode = TabSizeMode.Fixed
.Dock = DockStyle.None
.Left -= 4
.Top -= 5
.Width = .Parent.Width + 8
.Height = .Parent.Height + 9
.Anchor = AnchorStyles.Left Or AnchorStyles.Top Or AnchorStyles.Right Or AnchorStyles.Bottom
.Appearance = TabAppearance.Buttons
End With
With tbcReportTab.TabPages(0)
.BackColor = System.Drawing.Color.FromArgb(255, 148, 154, 173)
End With
End Sub
kailash rPosted Jan 6, 2010, 5:24 AM
kailash rPosted Jan 6, 2010, 1:57 AM
Nilanka DharmadasaPosted Jan 6, 2010, 1:22 AM
Anyway if your application is a windows one, there is no such tab in the crystal report viewer.
If your application is a web based one, setting following property of crystal report viewer will hide the tab.
protected void Page_Load(object sender, EventArgs e)
{
CrystalReportViewer1.HasDrilldownTabs = false;
}
I hope I understood your code correctly.
If you find my answer useful, please tick 'Do you like my answer' checkbox.
kailash rPosted Jan 6, 2010, 12:48 AM
kailash rPosted Jan 6, 2010, 12:46 AM
TabControl tab = (TabControl)((PageView)control).Controls[0];
Invalid index value error in controls array. Same error occurred in my code also.
Santhosh NPosted Jan 5, 2010, 9:53 AM
{{{if (!visible){tab.ItemSize = new Size(0, 1);else{tab.ItemSize = new Size(67, 18);