Add custom button to preview toolbar

Stimulsoft Reports.NET discussion
Post Reply
cleanac
Posts: 2
Joined: Thu Feb 05, 2009 4:00 am
Location: si

Add custom button to preview toolbar

Post by cleanac »

Hello.

I'm using a class to show and edit reports. I'm trying to add a custom button to the preview toolbar, but it won't work.

Here is the code i use.

Code: Select all

//first i create the report object
StiReport rReport = new StiReport();

//then i do some loading stuff.....

//code for adding custom button
StiPreviewForm frmPrev = new StiPreviewForm(rReport);
Stimulsoft.Controls.Win.DotNetBar.ButtonItem btnEdit = new Stimulsoft.Controls.Win.DotNetBar.ButtonItem();
btnEdit.Text = "TestButton";
btnEdit.Click += new EventHandler(btnEdit_Click);
btnEdit.Visible = true;
frmPrev.ViewerControl.ToolBar.Items.Add(btnEdit);

//show the report
rReport.Show();
The button simply won't show up. Is there any other way to do it?

Thanks

cleanac
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Add custom button to preview toolbar

Post by Edward »

Hi,

Please modify the code a little bit:

Code: Select all

//create the report object
StiReport rReport = new StiReport();
rReport.Load("myReport.mrt");

//code for adding custom button
StiPreviewForm frmPrev = new StiPreviewForm(rReport);
Stimulsoft.Controls.Win.DotNetBar.ButtonItem btnEdit = new Stimulsoft.Controls.Win.DotNetBar.ButtonItem();
btnEdit.Text = "TestButton";
btnEdit.Click += new EventHandler(btnEdit_Click);
btnEdit.Visible = true;
frmPrev.ViewerControl.ToolBar.Items.Add(btnEdit);            
rReport.Render();
//show the custom created form with a previewControl in it
frmPrev.Show();
Thank you.
cleanac
Posts: 2
Joined: Thu Feb 05, 2009 4:00 am
Location: si

Add custom button to preview toolbar

Post by cleanac »

Hello,

Works great.

Thank you.
Edward
Posts: 2913
Joined: Fri Jun 09, 2006 4:02 am

Add custom button to preview toolbar

Post by Edward »

Hello.

Please let us know if any additional help is required.

Thank you.
Post Reply