Tuesday, February 14, 2012

Creating custom controls

Hi all,
Using SQL Server 2000, Visual Studio .NET and the Report Project Wizard I've
nearly been able to create the kind of reports I like.
What I'd like to do now is to create a custom control and have it appear on
the Report Items toolbox along with the other report controls (Textbox,
Line, Table, Matrix etc.). I've tried creating an empty class:
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;
using Microsoft.ReportDesigner;
using Microsoft.VisualStudio;
using Microsoft.ReportDesigner.Controls;
using Microsoft.ReportDesigner.Drawing;
using Microsoft.ReportDesigner.Serialization;
using System.Collections.Specialized;
using System.Xml.Serialization;
using Microsoft.ReportDesigner.Interop;
namespace ReportControl
{
public sealed class MyReportControl :
Microsoft.ReportDesigner.Controls.ReportControl
{
}
}
But when I build this as a dll and try and add it into the Report Items
toolbox I get the following error "File or assembly name
Microsoft.DataWarehouse, or one of its dependencies, was not found." I've
had a good look around on Google for any information on this error or
information on how to create a custom control for sql reporting services
without finding any. Could anybody please tell me if it is possible to
create custom controls for SQL 2000 reporting services? If so, is there any
information I can read on it?
I've read on:
http://msdn.microsoft.com/SQL/2005/2005Webcasts/ReportingServicesQandA.aspx
that:
"Sachin Asked: Can Reporting services be used to pull up reports from a C#
Windows Forms application?
Answered: Yes, this will be easily possible using the new Reporting Services
Winforms control which will ship in Visual Studio 2005."
Does this mean that I'll be able to use my own custom-created
System.Windows.Forms.Control within this new Reporting Services Winforms
control?
Many thanks for any head-ups on any of these questions,
Best Regards,
Christopher Ireland> "Sachin Asked: Can Reporting services be used to pull up reports from a C#
> Windows Forms application?
> Answered: Yes, this will be easily possible using the new Reporting
> Services
> Winforms control which will ship in Visual Studio 2005."
> Does this mean that I'll be able to use my own custom-created
> System.Windows.Forms.Control within this new Reporting Services Winforms
> control?
No. The Winforms control can only be used to process and render existing
reports.
However, RS 2005 will add a so-called CustomReportItem. You can write
controls that implement certain interfaces and can then plug into report
designer and into report processing.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Christopher Ireland" <cireland@.gmail.com> wrote in message
news:e7oxVjOQFHA.1500@.TK2MSFTNGP09.phx.gbl...
> Hi all,
> Using SQL Server 2000, Visual Studio .NET and the Report Project Wizard
> I've
> nearly been able to create the kind of reports I like.
> What I'd like to do now is to create a custom control and have it appear
> on
> the Report Items toolbox along with the other report controls (Textbox,
> Line, Table, Matrix etc.). I've tried creating an empty class:
> using System;
> using System.Collections;
> using System.ComponentModel;
> using System.Drawing;
> using System.Data;
> using System.Windows.Forms;
> using Microsoft.ReportDesigner;
> using Microsoft.VisualStudio;
> using Microsoft.ReportDesigner.Controls;
> using Microsoft.ReportDesigner.Drawing;
> using Microsoft.ReportDesigner.Serialization;
> using System.Collections.Specialized;
> using System.Xml.Serialization;
> using Microsoft.ReportDesigner.Interop;
> namespace ReportControl
> {
> public sealed class MyReportControl :
> Microsoft.ReportDesigner.Controls.ReportControl
> {
> }
> }
> But when I build this as a dll and try and add it into the Report Items
> toolbox I get the following error "File or assembly name
> Microsoft.DataWarehouse, or one of its dependencies, was not found." I've
> had a good look around on Google for any information on this error or
> information on how to create a custom control for sql reporting services
> without finding any. Could anybody please tell me if it is possible to
> create custom controls for SQL 2000 reporting services? If so, is there
> any
> information I can read on it?
> I've read on:
> http://msdn.microsoft.com/SQL/2005/2005Webcasts/ReportingServicesQandA.aspx
> that:
> "Sachin Asked: Can Reporting services be used to pull up reports from a C#
> Windows Forms application?
> Answered: Yes, this will be easily possible using the new Reporting
> Services
> Winforms control which will ship in Visual Studio 2005."
> Does this mean that I'll be able to use my own custom-created
> System.Windows.Forms.Control within this new Reporting Services Winforms
> control?
> Many thanks for any head-ups on any of these questions,
> Best Regards,
> Christopher Ireland
>|||"Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
news:#Jh53L7QFHA.4028@.tk2msftngp13.phx.gbl...
> > "Sachin Asked: Can Reporting services be used to pull up reports from a
C#
> > Windows Forms application?
> > Answered: Yes, this will be easily possible using the new Reporting
> > Services
> > Winforms control which will ship in Visual Studio 2005."
> >
> > Does this mean that I'll be able to use my own custom-created
> > System.Windows.Forms.Control within this new Reporting Services Winforms
> > control?
> No. The Winforms control can only be used to process and render existing
> reports.
> However, RS 2005 will add a so-called CustomReportItem. You can write
> controls that implement certain interfaces and can then plug into report
> designer and into report processing.
Excellent. Thank you very much Robert, I'll look into it.
Best Regards,
Christopher Ireland.|||"Christopher Ireland" <cireland@.gmail.com> wrote in message
news:e8x6rO#QFHA.2384@.tk2msftngp13.phx.gbl...
> "Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
> news:#Jh53L7QFHA.4028@.tk2msftngp13.phx.gbl...
> > However, RS 2005 will add a so-called CustomReportItem. You can write
> > controls that implement certain interfaces and can then plug into report
> > designer and into report processing.
> Excellent. Thank you very much Robert, I'll look into it.
Hi Robert,
It seems that when using the VS2005 Beta 2 (April 2005) along with the SQL
Server 2005 CTP (April 2005), CustomReportItem is sealed although there is a
ICustomReportItem interface.
I don't suppose you know where I could get an example of how to author a
custom control for SQL Server 2005 CTP (April 2005) ReportingServices using
VS2005 Beta 2 (April 2005), something along the lines of the SimpleControl
Sample for Windows Forms control?
Many thanks,
Chris.|||Well, since I worked on the design and the implementation, I certainly
should know how it works :). I want to add that CustomReportItem (CRI) in RS
2005 serves one main purpose: allow the integration of additional charting
capabilities. Hence, a CustomReportItem at this point can create an image
(with image maps) or a textbox, but not yet complex RDL report items at
processing time. The new data grouping RDL structure of the CustomReportItem
will also show how we will make table or matrix more powerful in future
releases.
The ICustomReportItem interface is the way to go. We are working on making
an interesting but yet not too complex sample publicly available that shows
how to implement a CRI design-time control (for report designer) and a CRI
processing control (for report server). We hope to have the sample and
documentation ready when we release RS 2005.
In the meantime you may want to look for a session at the upcoming TechEd
2005 conference presented by Andrew Bryan (Dundas Software). He will talk
about their work using the CRI approach (derived from complex prototypes we
have built) and how to build your own CRI controls:
http://www.msteched.com/content/sessions.aspx, Session BIN335 - "SQL Server
2005 Reporting Services Custom Report Items", Thursday, June 9, 5:00 PM -
6:15 PM.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
"Christopher Ireland" <cireland@.gmail.com> wrote in message
news:u2zQD%23%23TFHA.616@.TK2MSFTNGP12.phx.gbl...
> "Christopher Ireland" <cireland@.gmail.com> wrote in message
> news:e8x6rO#QFHA.2384@.tk2msftngp13.phx.gbl...
>> "Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
>> news:#Jh53L7QFHA.4028@.tk2msftngp13.phx.gbl...
>> > However, RS 2005 will add a so-called CustomReportItem. You can write
>> > controls that implement certain interfaces and can then plug into
>> > report
>> > designer and into report processing.
>> Excellent. Thank you very much Robert, I'll look into it.
> Hi Robert,
> It seems that when using the VS2005 Beta 2 (April 2005) along with the SQL
> Server 2005 CTP (April 2005), CustomReportItem is sealed although there is
> a
> ICustomReportItem interface.
> I don't suppose you know where I could get an example of how to author a
> custom control for SQL Server 2005 CTP (April 2005) ReportingServices
> using
> VS2005 Beta 2 (April 2005), something along the lines of the SimpleControl
> Sample for Windows Forms control?
> Many thanks,
> Chris.
>|||"Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
news:#r1drZAUFHA.3352@.TK2MSFTNGP12.phx.gbl...
> Well, since I worked on the design and the implementation, I certainly
> should know how it works :).
Excellent! Many thanks for taking some time out to answer mine (and others)
questions!!
> The ICustomReportItem interface is the way to go. We are working on making
> an interesting but yet not too complex sample publicly available that
shows
> how to implement a CRI design-time control (for report designer) and a CRI
> processing control (for report server). We hope to have the sample and
> documentation ready when we release RS 2005.
That would be fantastic.
In the meantime I wonder if you're up for giving me a couple of tips in the
meantime <g>. My first objective is to get my custom component on the Report
Items ToolBox, so I created a simple dummy class that looks like this:
using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.ReportingServices.Interfaces;
using Microsoft.ReportingServices.ReportProcessing;
using Microsoft.ReportingServices.ReportRendering;
namespace MyReportControl
{
public class MyNonDundasChart : ReportItem
{
public MyNonDundasChart() { }
}
public class MyReportControl : ICustomReportItem
{
private CustomReportItem customItem;
public ChangeType Process()
{
return ChangeType.None;
}
public Action Action
{
get { return new Action(); }
}
public CustomReportItem CustomItem
{
set { customItem = value;}
}
public ReportItem RenderItem
{
get { return new MyNonDundasChart(); }
}
}
}
However, when I try and add MyReportControl.dll into the Report Items
ToolBox, I get the following error:
There are no components in
"C:\Test\ReportProject1\MyReportControl\bin\Debug\MyReportControl.dll" that
can be placed on the toolbox.
Any chance of giving me a couple of "preview" pointers? Please <gg>?
> In the meantime you may want to look for a session at the upcoming TechEd
> 2005 conference presented by Andrew Bryan (Dundas Software). He will talk
> about their work using the CRI approach (derived from complex prototypes
we
> have built) and how to build your own CRI controls:
> http://www.msteched.com/content/sessions.aspx, Session BIN335 - "SQL
Server
> 2005 Reporting Services Custom Report Items", Thursday, June 9, 5:00 PM -
> 6:15 PM.
Maybe I'll look into getting the DVD set which may have this session on it;
Orlando, Florida is quite a way from Girona, Catalonia :-)
Best Regards,
Chris.|||Well, writing and integrating your design time control is not that simple.
Also registering it in the VS toolbox is not trivial at this point in VS
2005 Beta 2 and requires a set of manual steps (this will hopefully change
and be simplified with VS 2005 RTM). I would recommend you wait till we have
the sample ready.
Regarding the TechEd session - it seems to be pretty popular so far (based
on the registrations). Popular sessions are more likely to be recorded and
available on the post-conference DVD set.
-- Robert
This posting is provided "AS IS" with no warranties, and confers no rights.
"Christopher Ireland" <cireland@.gmail.com> wrote in message
news:%23HQGV2iUFHA.3244@.TK2MSFTNGP15.phx.gbl...
> "Robert Bruckner [MSFT]" <robruc@.online.microsoft.com> wrote in message
> news:#r1drZAUFHA.3352@.TK2MSFTNGP12.phx.gbl...
>> Well, since I worked on the design and the implementation, I certainly
>> should know how it works :).
> Excellent! Many thanks for taking some time out to answer mine (and
> others)
> questions!!
>> The ICustomReportItem interface is the way to go. We are working on
>> making
>> an interesting but yet not too complex sample publicly available that
> shows
>> how to implement a CRI design-time control (for report designer) and a
>> CRI
>> processing control (for report server). We hope to have the sample and
>> documentation ready when we release RS 2005.
> That would be fantastic.
> In the meantime I wonder if you're up for giving me a couple of tips in
> the
> meantime <g>. My first objective is to get my custom component on the
> Report
> Items ToolBox, so I created a simple dummy class that looks like this:
> using System;
> using System.Collections.Generic;
> using System.Text;
> using Microsoft.ReportingServices.Interfaces;
> using Microsoft.ReportingServices.ReportProcessing;
> using Microsoft.ReportingServices.ReportRendering;
> namespace MyReportControl
> {
> public class MyNonDundasChart : ReportItem
> {
> public MyNonDundasChart() { }
> }
> public class MyReportControl : ICustomReportItem
> {
> private CustomReportItem customItem;
> public ChangeType Process()
> {
> return ChangeType.None;
> }
> public Action Action
> {
> get { return new Action(); }
> }
> public CustomReportItem CustomItem
> {
> set { customItem = value;}
> }
> public ReportItem RenderItem
> {
> get { return new MyNonDundasChart(); }
> }
> }
> }
>
> However, when I try and add MyReportControl.dll into the Report Items
> ToolBox, I get the following error:
> There are no components in
> "C:\Test\ReportProject1\MyReportControl\bin\Debug\MyReportControl.dll"
> that
> can be placed on the toolbox.
> Any chance of giving me a couple of "preview" pointers? Please <gg>?
>> In the meantime you may want to look for a session at the upcoming TechEd
>> 2005 conference presented by Andrew Bryan (Dundas Software). He will talk
>> about their work using the CRI approach (derived from complex prototypes
> we
>> have built) and how to build your own CRI controls:
>> http://www.msteched.com/content/sessions.aspx, Session BIN335 - "SQL
> Server
>> 2005 Reporting Services Custom Report Items", Thursday, June 9, 5:00 PM -
>> 6:15 PM.
> Maybe I'll look into getting the DVD set which may have this session on
> it;
> Orlando, Florida is quite a way from Girona, Catalonia :-)
> Best Regards,
> Chris.
>

No comments:

Post a Comment